<?php
namespace App\Entity;
use App\Repository\ParticipantRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass=ParticipantRepository::class)
*/
class Participant
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $first_name;
/**
* @ORM\Column(type="string", length=255)
*/
private $last_name;
/**
* @ORM\Column(type="string", length=255, unique=true)
*/
private $cin;
/**
* @ORM\Column(type="string", length=255)
*/
private $phone;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $email;
/**
* @ORM\ManyToOne(targetEntity=Customer::class, inversedBy="participant")
* @ORM\JoinColumn(name="customer_id", referencedColumnName="id", nullable=true)
*/
private $customer;
/**
* @ORM\OneToMany(targetEntity=Order::class, mappedBy="responsible")
*/
private $orders;
/**
* @ORM\OneToMany(targetEntity=OrderParticipantBike::class, mappedBy="participant")
*/
private $orderParticipantBikes;
/**
* @ORM\Column(type="datetime_immutable")
* @Gedmo\Timestampable(on="create")
*/
private $created_at;
/**
* @ORM\Column(type="datetime_immutable")
* @Gedmo\Timestampable(on="update")
*/
private $updated_at;
public function __construct()
{
$this->orders = new ArrayCollection();
$this->orderParticipantBikes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getFirstName(): ?string
{
return $this->first_name;
}
public function setFirstName(string $first_name): self
{
$this->first_name = $first_name;
return $this;
}
public function getLastName(): ?string
{
return $this->last_name;
}
public function setLastName(string $last_name): self
{
$this->last_name = $last_name;
return $this;
}
public function getCin(): ?string
{
return $this->cin;
}
public function setCin(string $cin): self
{
$this->cin = $cin;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getCustomer(): ?Customer
{
return $this->customer;
}
public function setCustomer(?Customer $customer): self
{
$this->customer = $customer;
return $this;
}
/**
* @return Collection<int, Order>
*/
public function getOrders(): Collection
{
return $this->orders;
}
public function addOrder(Order $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->setDiscount($this);
}
return $this;
}
public function removeOrder(Order $order): self
{
if ($this->orders->removeElement($order)) {
// set the owning side to null (unless already changed)
if ($order->getDiscount() === $this) {
$order->setDiscount(null);
}
}
return $this;
}
/**
* @return Collection<int, OrderParticipantBike>
*/
public function getOrderParticipantBikes(): Collection
{
return $this->orderParticipantBikes;
}
public function addOrderParticipantBike(OrderParticipantBike $orderParticipantBike): self
{
if (!$this->orderParticipantBikes->contains($orderParticipantBike)) {
$this->orderParticipantBikes[] = $orderParticipantBike;
$orderParticipantBike->setParticipant($this);
}
return $this;
}
public function removeOrderParticipantBike(OrderParticipantBike $orderParticipantBike): self
{
if ($this->orderParticipantBikes->removeElement($orderParticipantBike)) {
// set the owning side to null (unless already changed)
if ($orderParticipantBike->getParticipant() === $this) {
$orderParticipantBike->setParticipant(null);
}
}
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeImmutable $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updated_at;
}
public function setUpdatedAt(\DateTimeImmutable $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
}