src/Entity/Abonnement.php line 18

  1. <?php
  2. namespace App\Entity;
  3. use Symfony\Component\Uid\Ulid;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Repository\AbonnementRepository;
  6. use ApiPlatform\Core\Annotation\ApiResource;
  7. use Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. #[ORM\Entity(repositoryClassAbonnementRepository::class)]
  10. #[Gedmo\SoftDeleteable(fieldName'deletedAt'timeAwarefalsehardDeletetrue)]
  11. #[ORM\HasLifecycleCallbacks]
  12. // #[ApiResource(
  13. //     attributes: ["security" => "is_granted('IS_AUTHENTICATED_FULLY')"],
  14. // )]
  15. class Abonnement
  16. {
  17.     use Timestamps;
  18.     #[ORM\Id]
  19.     #[ORM\Column(type'ulid'uniquetrue)]
  20.     #[ORM\GeneratedValue(strategy"CUSTOM")]
  21.     #[ORM\CustomIdGenerator(class: UlidGenerator::class)]
  22.     private ?Ulid $id null;
  23.     #[ORM\Column(type'datetime')]
  24.     private $start_date;
  25.     #[ORM\Column(type'datetime')]
  26.     private $expire_date;
  27.     #[ORM\ManyToOne(targetEntityProduct::class, inversedBy'abonnements')]
  28.     #[ORM\JoinColumn(nullablefalse)]
  29.     private $product;
  30.     #[ORM\ManyToOne(targetEntityCompany::class, inversedBy'abonnements')]
  31.     #[ORM\JoinColumn(nullablefalse)]
  32.     private $owner;
  33.     public function getId(): ?Ulid
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getStartDate(): ?\DateTimeInterface
  38.     {
  39.         return $this->start_date;
  40.     }
  41.     public function setStartDate(\DateTimeInterface $start_date): self
  42.     {
  43.         $this->start_date $start_date;
  44.         return $this;
  45.     }
  46.     public function getExpireDate(): ?\DateTimeInterface
  47.     {
  48.         return $this->expire_date;
  49.     }
  50.     public function setExpireDate(\DateTimeInterface $expire_date): self
  51.     {
  52.         $this->expire_date $expire_date;
  53.         return $this;
  54.     }
  55.     public function getProduct(): ?Product
  56.     {
  57.         return $this->product;
  58.     }
  59.     public function setProduct(?Product $product): self
  60.     {
  61.         $this->product $product;
  62.         return $this;
  63.     }
  64.     public function getOwner(): ?Company
  65.     {
  66.         return $this->owner;
  67.     }
  68.     public function setOwner(?Company $owner): self
  69.     {
  70.         $this->owner $owner;
  71.         return $this;
  72.     }
  73. }