src/Flexy/ShopBundle/Entity/Product/ProductSubscription.php line 16

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Product;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Flexy\ShopBundle\Entity\Customer\Customer;
  5. use App\Flexy\ShopBundle\Entity\Order\OrderItem;
  6. use App\Flexy\ShopBundle\Entity\Payment\Payment;
  7. use App\Repository\Flexy\ShopBundle\Entity\Product\ProductSubscriptionRepository;
  8. use DateTime;
  9. use Doctrine\DBAL\Types\Types;
  10. use Doctrine\ORM\Mapping as ORM;
  11. #[ORM\Entity(repositoryClassProductSubscriptionRepository::class)]
  12. #[ApiResource]
  13. class ProductSubscription
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     private ?int $id null;
  19.     #[ORM\ManyToOne(inversedBy'productSubscriptions')]
  20.     #[ORM\JoinColumn(nullablefalse)]
  21.     private ?Product $product null;
  22.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  23.     private ?\DateTimeInterface $startAt ;
  24.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  25.     private ?\DateTimeInterface $endAt null;
  26.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  27.     private ?string $description null;
  28.     #[ORM\Column(length255nullabletrue)]
  29.     private ?string $status null;
  30.   
  31.     #[ORM\ManyToOne(inversedBy'productSubscriptions',cascade:["persist"])]
  32.     private ?Customer $customer null;
  33.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  34.     private ?\DateTimeInterface $createdAt null;
  35.     #[ORM\OneToOne(cascade: ['persist''remove'])]
  36.     private ?OrderItem $orderItem null;
  37.     public function __construct()
  38.     {
  39.         $this->createdAt = new \DateTime();
  40.         $this->startAt = new \DateTime();
  41.     }
  42.     
  43.      public function __toString(): string
  44.     {
  45.         return "Numéro ".$this->getId();
  46.     }
  47.     
  48.     public function getId(): ?int
  49.     {
  50.         return $this->id;
  51.     }
  52.     public function getProduct(): ?Product
  53.     {
  54.         return $this->product;
  55.     }
  56.     public function setProduct(?Product $product): self
  57.     {
  58.         $this->product $product;
  59.         return $this;
  60.     }
  61.     public function getStartAt(): ?\DateTimeInterface
  62.     {
  63.         return $this->startAt;
  64.     }
  65.     public function setStartAt(\DateTimeInterface $startAt): self
  66.     {
  67.         $this->startAt $startAt;
  68.         return $this;
  69.     }
  70.     public function getEndAt(): ?\DateTimeInterface
  71.     {
  72.         return $this->endAt;
  73.     }
  74.     public function setEndAt(\DateTimeInterface $endAt): self
  75.     {
  76.         $this->endAt $endAt;
  77.         return $this;
  78.     }
  79.     public function getDescription(): ?string
  80.     {
  81.         return $this->description;
  82.     }
  83.     public function setDescription(?string $description): self
  84.     {
  85.         $this->description $description;
  86.         return $this;
  87.     }
  88.     public function getStatus(): ?string
  89.     {
  90.         return $this->status;
  91.     }
  92.     public function setStatus(?string $status): self
  93.     {
  94.         $this->status $status;
  95.         return $this;
  96.     }
  97.     public function getCustomer(): ?Customer
  98.     {
  99.         return $this->customer;
  100.     }
  101.     public function setCustomer(?Customer $customer): self
  102.     {
  103.         $this->customer $customer;
  104.         return $this;
  105.     }
  106.     public function getCreatedAt(): ?\DateTimeInterface
  107.     {
  108.         return $this->createdAt;
  109.     }
  110.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  111.     {
  112.         $this->createdAt $createdAt;
  113.         return $this;
  114.     }
  115.     public function getOrderItem(): ?OrderItem
  116.     {
  117.         return $this->orderItem;
  118.     }
  119.     public function setOrderItem(?OrderItem $orderItem): self
  120.     {
  121.         $this->orderItem $orderItem;
  122.         return $this;
  123.     }
  124. }