src/Flexy/ShopBundle/Entity/Product/ProductSubscription.php line 16
<?phpnamespace App\Flexy\ShopBundle\Entity\Product;use ApiPlatform\Metadata\ApiResource;use App\Flexy\ShopBundle\Entity\Customer\Customer;use App\Flexy\ShopBundle\Entity\Order\OrderItem;use App\Flexy\ShopBundle\Entity\Payment\Payment;use App\Repository\Flexy\ShopBundle\Entity\Product\ProductSubscriptionRepository;use DateTime;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: ProductSubscriptionRepository::class)]#[ApiResource]class ProductSubscription{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\ManyToOne(inversedBy: 'productSubscriptions')]#[ORM\JoinColumn(nullable: false)]private ?Product $product = null;#[ORM\Column(type: Types::DATETIME_MUTABLE)]private ?\DateTimeInterface $startAt ;#[ORM\Column(type: Types::DATETIME_MUTABLE)]private ?\DateTimeInterface $endAt = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $description = null;#[ORM\Column(length: 255, nullable: true)]private ?string $status = null;#[ORM\ManyToOne(inversedBy: 'productSubscriptions',cascade:["persist"])]private ?Customer $customer = null;#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $createdAt = null;#[ORM\OneToOne(cascade: ['persist', 'remove'])]private ?OrderItem $orderItem = null;public function __construct(){$this->createdAt = new \DateTime();$this->startAt = new \DateTime();}public function __toString(): string{return "Numéro ".$this->getId();}public function getId(): ?int{return $this->id;}public function getProduct(): ?Product{return $this->product;}public function setProduct(?Product $product): self{$this->product = $product;return $this;}public function getStartAt(): ?\DateTimeInterface{return $this->startAt;}public function setStartAt(\DateTimeInterface $startAt): self{$this->startAt = $startAt;return $this;}public function getEndAt(): ?\DateTimeInterface{return $this->endAt;}public function setEndAt(\DateTimeInterface $endAt): self{$this->endAt = $endAt;return $this;}public function getExportData(){return \array_merge(['Produit ' => $this->product,'Client' => $this->customer,'Téléphone' => $this->customer->getPhone() ,'Se commence à' => $this->startAt ? $this->startAt->format('Y-m-d H:i:s') : '','Se termine' => $this->endAt ? $this->endAt->format('Y-m-d H:i:s') : '',]);}public function getDescription(): ?string{return $this->description;}public function setDescription(?string $description): self{$this->description = $description;return $this;}public function getStatus(): ?string{return $this->status;}public function setStatus(?string $status): self{$this->status = $status;return $this;}public function getCustomer(): ?Customer{return $this->customer;}public function setCustomer(?Customer $customer): self{$this->customer = $customer;return $this;}public function getCreatedAt(): ?\DateTimeInterface{return $this->createdAt;}public function setCreatedAt(?\DateTimeInterface $createdAt): self{$this->createdAt = $createdAt;return $this;}public function getOrderItem(): ?OrderItem{return $this->orderItem;}public function setOrderItem(?OrderItem $orderItem): self{$this->orderItem = $orderItem;return $this;}}