src/Entity/Participant.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ParticipantRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ParticipantRepository::class)
  10.  */
  11. class Participant
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $first_name;
  23.     /**
  24.      * @ORM\Column(type="string", length=255)
  25.      */
  26.     private $last_name;
  27.     /**
  28.      * @ORM\Column(type="string", length=255, unique=true)
  29.      */
  30.     private $cin;
  31.     /**
  32.      * @ORM\Column(type="string", length=255)
  33.      */
  34.     private $phone;
  35.     /**
  36.      * @ORM\Column(type="string", length=255, nullable=true)
  37.      */
  38.     private $email;
  39.     /**
  40.      * @ORM\ManyToOne(targetEntity=Customer::class, inversedBy="participant")
  41.      * @ORM\JoinColumn(name="customer_id", referencedColumnName="id", nullable=true)
  42.      */
  43.     private $customer;
  44.     /**
  45.      * @ORM\OneToMany(targetEntity=Order::class, mappedBy="responsible")
  46.      */
  47.     private $orders;
  48.     /**
  49.      * @ORM\OneToMany(targetEntity=OrderParticipantBike::class, mappedBy="participant")
  50.      */
  51.     private $orderParticipantBikes;
  52.     /**
  53.      * @ORM\Column(type="datetime_immutable")
  54.      * @Gedmo\Timestampable(on="create")
  55.      */
  56.     private $created_at;
  57.     /**
  58.      * @ORM\Column(type="datetime_immutable")
  59.      * @Gedmo\Timestampable(on="update")
  60.      */
  61.     private $updated_at;
  62.     public function __construct()
  63.     {
  64.         $this->orders = new ArrayCollection();
  65.         $this->orderParticipantBikes = new ArrayCollection();
  66.     }
  67.     public function getId(): ?int
  68.     {
  69.         return $this->id;
  70.     }
  71.     public function getFirstName(): ?string
  72.     {
  73.         return $this->first_name;
  74.     }
  75.     public function setFirstName(string $first_name): self
  76.     {
  77.         $this->first_name $first_name;
  78.         return $this;
  79.     }
  80.     public function getLastName(): ?string
  81.     {
  82.         return $this->last_name;
  83.     }
  84.     public function setLastName(string $last_name): self
  85.     {
  86.         $this->last_name $last_name;
  87.         return $this;
  88.     }
  89.     public function getCin(): ?string
  90.     {
  91.         return $this->cin;
  92.     }
  93.     public function setCin(string $cin): self
  94.     {
  95.         $this->cin $cin;
  96.         return $this;
  97.     }
  98.     public function getPhone(): ?string
  99.     {
  100.         return $this->phone;
  101.     }
  102.     public function setPhone(string $phone): self
  103.     {
  104.         $this->phone $phone;
  105.         return $this;
  106.     }
  107.     public function getEmail(): ?string
  108.     {
  109.         return $this->email;
  110.     }
  111.     public function setEmail(string $email): self
  112.     {
  113.         $this->email $email;
  114.         return $this;
  115.     }
  116.     public function getCustomer(): ?Customer
  117.     {
  118.         return $this->customer;
  119.     }
  120.     public function setCustomer(?Customer $customer): self
  121.     {
  122.         $this->customer $customer;
  123.         return $this;
  124.     }
  125.     /**
  126.      * @return Collection<int, Order>
  127.      */
  128.     public function getOrders(): Collection
  129.     {
  130.         return $this->orders;
  131.     }
  132.     public function addOrder(Order $order): self
  133.     {
  134.         if (!$this->orders->contains($order)) {
  135.             $this->orders[] = $order;
  136.             $order->setDiscount($this);
  137.         }
  138.         return $this;
  139.     }
  140.     public function removeOrder(Order $order): self
  141.     {
  142.         if ($this->orders->removeElement($order)) {
  143.             // set the owning side to null (unless already changed)
  144.             if ($order->getDiscount() === $this) {
  145.                 $order->setDiscount(null);
  146.             }
  147.         }
  148.         return $this;
  149.     }
  150.     /**
  151.      * @return Collection<int, OrderParticipantBike>
  152.      */
  153.     public function getOrderParticipantBikes(): Collection
  154.     {
  155.         return $this->orderParticipantBikes;
  156.     }
  157.     public function addOrderParticipantBike(OrderParticipantBike $orderParticipantBike): self
  158.     {
  159.         if (!$this->orderParticipantBikes->contains($orderParticipantBike)) {
  160.             $this->orderParticipantBikes[] = $orderParticipantBike;
  161.             $orderParticipantBike->setParticipant($this);
  162.         }
  163.         return $this;
  164.     }
  165.     public function removeOrderParticipantBike(OrderParticipantBike $orderParticipantBike): self
  166.     {
  167.         if ($this->orderParticipantBikes->removeElement($orderParticipantBike)) {
  168.             // set the owning side to null (unless already changed)
  169.             if ($orderParticipantBike->getParticipant() === $this) {
  170.                 $orderParticipantBike->setParticipant(null);
  171.             }
  172.         }
  173.         return $this;
  174.     }
  175.     public function getCreatedAt(): ?\DateTimeImmutable
  176.     {
  177.         return $this->created_at;
  178.     }
  179.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  180.     {
  181.         $this->created_at $created_at;
  182.         return $this;
  183.     }
  184.     public function getUpdatedAt(): ?\DateTimeImmutable
  185.     {
  186.         return $this->updated_at;
  187.     }
  188.     public function setUpdatedAt(\DateTimeImmutable $updated_at): self
  189.     {
  190.         $this->updated_at $updated_at;
  191.         return $this;
  192.     }
  193. }