src/Entity/PortalLicense.php line 16

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\PortalLicenseRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[ORM\Entity(repositoryClassPortalLicenseRepository::class)]
  10. #[ApiResource(
  11.     mercuretrue
  12. )]
  13. class PortalLicense
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     private ?int $id null;
  19.     #[ORM\Column(length255)]
  20.     private ?string $name null;
  21.     #[ORM\Column(typeTypes::TEXT)]
  22.     private ?string $description null;
  23.     #[ORM\OneToMany(mappedBy'portalLicense'targetEntityPortal::class)]
  24.     private Collection $portals;
  25.     #[ORM\ManyToMany(targetEntityPortalFeature::class, inversedBy'portalLicenses')]
  26.     private Collection $portalFeatures;
  27.     #[ORM\Column]
  28.     private ?bool $active null;
  29.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  30.     private ?\DateTimeInterface $validTill null;
  31.     public function __construct()
  32.     {
  33.         $this->portals = new ArrayCollection();
  34.         $this->portalFeatures = new ArrayCollection();
  35.         $this->validTill = new \DateTime();
  36.         $this->setDescription('Beschreibung');
  37.     }
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function __toString(): string
  43.     {
  44.         return $this->name;
  45.     }
  46.     public function getName(): ?string
  47.     {
  48.         return $this->name;
  49.     }
  50.     public function setName(string $name): self
  51.     {
  52.         $this->name $name;
  53.         return $this;
  54.     }
  55.     public function getDescription(): ?string
  56.     {
  57.         return $this->description;
  58.     }
  59.     public function setDescription(string $description): self
  60.     {
  61.         $this->description $description;
  62.         return $this;
  63.     }
  64.     /**
  65.      * @return Collection<int, Portal>
  66.      */
  67.     public function getPortals(): Collection
  68.     {
  69.         return $this->portals;
  70.     }
  71.     public function addPortal(Portal $portal): self
  72.     {
  73.         if (!$this->portals->contains($portal)) {
  74.             $this->portals->add($portal);
  75.             $portal->setPortalLicense($this);
  76.         }
  77.         return $this;
  78.     }
  79.     public function removePortal(Portal $portal): self
  80.     {
  81.         if ($this->portals->removeElement($portal)) {
  82.             // set the owning side to null (unless already changed)
  83.             if ($portal->getPortalLicense() === $this) {
  84.                 $portal->setPortalLicense(null);
  85.             }
  86.         }
  87.         return $this;
  88.     }
  89.     /**
  90.      * @return Collection<int, PortalFeature>
  91.      */
  92.     public function getPortalFeatures(): Collection
  93.     {
  94.         return $this->portalFeatures;
  95.     }
  96.     public function addPortalFeature(PortalFeature $portalFeature): self
  97.     {
  98.         if (!$this->portalFeatures->contains($portalFeature)) {
  99.             $this->portalFeatures->add($portalFeature);
  100.             $portalFeature->addPortalLicense($this);
  101.         }
  102.         return $this;
  103.     }
  104.     public function removePortalFeature(PortalFeature $portalFeature): self
  105.     {
  106.         if ($this->portalFeatures->removeElement($portalFeature)) {
  107.             $portalFeature->removePortalLicense($this);
  108.         }
  109.         return $this;
  110.     }
  111.     public function isActive(): ?bool
  112.     {
  113.         return $this->active;
  114.     }
  115.     public function setActive(bool $active): self
  116.     {
  117.         $this->active $active;
  118.         return $this;
  119.     }
  120.     public function getValidTill(): ?\DateTimeInterface
  121.     {
  122.         return $this->validTill;
  123.     }
  124.     public function setValidTill(\DateTimeInterface $validTill): self
  125.     {
  126.         $this->validTill $validTill;
  127.         return $this;
  128.     }
  129. }