src/Entity/CartItemParticipant.php line 12

Open in your IDE?
  1. <?php
  2.     namespace App\Entity;
  3.     use App\Repository\CartItemParticipantRepository;
  4.     use DateTimeInterface;
  5.     use Doctrine\ORM\Mapping as ORM;
  6.     /**
  7.      * @ORM\Entity(repositoryClass=CartItemParticipantRepository::class)
  8.      */
  9.     class CartItemParticipant
  10.     {
  11.         const TYPE_ADULT 'A';
  12.         const TYPE_CHILD 'E';
  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 $lastName;
  23.         /**
  24.          * @ORM\Column(type="string", length=255)
  25.          */
  26.         private $firstName;
  27.         /**
  28.          * @ORM\Column(type="string", length=1)
  29.          */
  30.         private $typeParticipant;
  31.         /**
  32.          * @ORM\ManyToOne(targetEntity=CartItem::class, inversedBy="participants")
  33.          * @ORM\JoinColumn(nullable=false)
  34.          */
  35.         private $cartItem;
  36.         /**
  37.          * @ORM\Column(type="date", nullable=true)
  38.          */
  39.         private $birthDate;
  40.         /**
  41.          * Index to link participants between items (otherwise if item quantity > 1 we have all participants of all products linked to only one item)
  42.          * @ORM\Column(type="integer", options={"default": 1})
  43.          */
  44.         private $quantityIndex 1;
  45.         public function __toString()
  46.         {
  47.             return strtoupper$this->lastName ) . ' ' $this->firstName ' - ' $this->birthDate->format'd/m/Y' );
  48.         }
  49.         public function getId(): ?int
  50.         {
  51.             return $this->id;
  52.         }
  53.         public function getLastName(): ?string
  54.         {
  55.             return $this->lastName;
  56.         }
  57.         public function setLastNamestring $lastName ): self
  58.         {
  59.             $this->lastName $lastName;
  60.             return $this;
  61.         }
  62.         public function getFirstName(): ?string
  63.         {
  64.             return $this->firstName;
  65.         }
  66.         public function setFirstNamestring $firstName ): self
  67.         {
  68.             $this->firstName $firstName;
  69.             return $this;
  70.         }
  71.         public function getTypeParticipant(): ?string
  72.         {
  73.             return $this->typeParticipant;
  74.         }
  75.         public function setTypeParticipantstring $typeParticipant ): self
  76.         {
  77.             $this->typeParticipant $typeParticipant;
  78.             return $this;
  79.         }
  80.         public function getCartItem(): ?CartItem
  81.         {
  82.             return $this->cartItem;
  83.         }
  84.         public function setCartItem( ?CartItem $cartItem ): self
  85.         {
  86.             $this->cartItem $cartItem;
  87.             return $this;
  88.         }
  89.         public function getBirthDate(): ?DateTimeInterface
  90.         {
  91.             return $this->birthDate;
  92.         }
  93.         public function setBirthDate( ?DateTimeInterface $birthDate ): self
  94.         {
  95.             $this->birthDate $birthDate;
  96.             return $this;
  97.         }
  98.         public function getQuantityIndex(): ?int
  99.         {
  100.             return $this->quantityIndex;
  101.         }
  102.         public function setQuantityIndexint $quantityIndex ): self
  103.         {
  104.             $this->quantityIndex $quantityIndex;
  105.             return $this;
  106.         }
  107.     }