src/Flexy/ShopBundle/Entity/Customer/PackEngagement.php line 12

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Customer;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Flexy\ShopBundle\Entity\Order\OrderItem;
  5. use App\Flexy\ShopBundle\Repository\Customer\PackEngagementRepository;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ApiResource]
  8. #[ORM\Entity(repositoryClassPackEngagementRepository::class)]
  9. class PackEngagement
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column(type'integer')]
  14.     private $id;
  15.     #[ORM\ManyToOne(targetEntityPack::class, inversedBy'packEngagements'cascade: ['persist'])]
  16.     private ?\App\Flexy\ShopBundle\Entity\Customer\Pack $pack null;
  17.     #[ORM\ManyToOne(targetEntityCustomer::class, inversedBy'packEngagements')]
  18.     private ?\App\Flexy\ShopBundle\Entity\Customer\Customer $customer null;
  19.     #[ORM\Column(type'datetime')]
  20.     private ?\DateTimeInterface $startAt null;
  21.     #[ORM\Column(type'datetime')]
  22.     private ?\DateTimeInterface $endAt null;
  23.     #[ORM\OneToOne(targetEntityOrderItem::class, mappedBy'packEngagement'cascade: ['persist''remove'])]
  24.     private ?\App\Flexy\ShopBundle\Entity\Order\OrderItem $orderItem null;
  25.     public function getId(): ?int
  26.     {
  27.         return $this->id;
  28.     }
  29.     public function getPack(): ?Pack
  30.     {
  31.         return $this->pack;
  32.     }
  33.     public function setPack(?Pack $pack): self
  34.     {
  35.         $this->pack $pack;
  36.         return $this;
  37.     }
  38.     public function getCustomer(): ?Customer
  39.     {
  40.         return $this->customer;
  41.     }
  42.     public function setCustomer(?Customer $customer): self
  43.     {
  44.         $this->customer $customer;
  45.         return $this;
  46.     }
  47.     public function getStartAt(): ?\DateTimeInterface
  48.     {
  49.         return $this->startAt;
  50.     }
  51.     public function setStartAt(\DateTimeInterface $startAt): self
  52.     {
  53.         $this->startAt $startAt;
  54.         return $this;
  55.     }
  56.     public function getEndAt(): ?\DateTimeInterface
  57.     {
  58.         return $this->endAt;
  59.     }
  60.     public function setEndAt(\DateTimeInterface $endAt): self
  61.     {
  62.         $this->endAt $endAt;
  63.         return $this;
  64.     }
  65.     public function getOrderItem(): ?OrderItem
  66.     {
  67.         return $this->orderItem;
  68.     }
  69.     public function setOrderItem(?OrderItem $orderItem): self
  70.     {
  71.         // unset the owning side of the relation if necessary
  72.         if ($orderItem === null && $this->orderItem !== null) {
  73.             $this->orderItem->setPackEngagement(null);
  74.         }
  75.         // set the owning side of the relation if necessary
  76.         if ($orderItem !== null && $orderItem->getPackEngagement() !== $this) {
  77.             $orderItem->setPackEngagement($this);
  78.         }
  79.         $this->orderItem $orderItem;
  80.         return $this;
  81.     }
  82. }