src/Entity/BaseSite/Plan/Plan.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\BaseSite\Plan;
  3. use App\Entity\BaseEntity;
  4. use App\Entity\Website\Website\Website;
  5. use App\Repository\BaseSite\Plan\PlanRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  11. #[ORM\Entity(repositoryClassPlanRepository::class)]
  12. #[ORM\Table(name'`base_site_plan`' )]
  13. class Plan extends BaseEntity
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\Column(type'guid'uniquetrue)]
  17.     #[ORM\GeneratedValue(strategy'CUSTOM')]
  18.     #[ORM\CustomIdGenerator(class: UuidGenerator::class)]
  19.     private ?string $id;
  20.     #[ORM\Column(length255)]
  21.     private ?string $title null;
  22.     #[ORM\Column(typeTypes::BIGINT)]
  23.     private ?string $days null;
  24.     #[ORM\Column]
  25.     private ?bool $isSystematic null;
  26.     #[ORM\OneToMany(mappedBy'currentPlan'targetEntityWebsite::class)]
  27.     private Collection $shops;
  28.     #[ORM\OneToMany(mappedBy'plan'targetEntityPlanFeature::class)]
  29.     private Collection $planFeatures;
  30.     #[ORM\Column]
  31.     private ?bool $isTrial null;
  32.     #[ORM\Column(typeTypes::BIGINT)]
  33.     private ?string $price null;
  34.     #[ORM\OneToMany(mappedBy'plan'targetEntityAddOn::class)]
  35.     private Collection $addOns;
  36.     #[ORM\Column(nullabletrue)]
  37.     private ?int $freeIrDomain null;
  38.     public function __construct()
  39.     {
  40.         parent::__construct();
  41.         $this->shops = new ArrayCollection();
  42.         $this->planFeatures = new ArrayCollection();
  43.         $this->addOns = new ArrayCollection();
  44.     }
  45.     public function getId(): ?string
  46.     {
  47.         return $this->id;
  48.     }
  49.     public function getTitle(): ?string
  50.     {
  51.         return $this->title;
  52.     }
  53.     public function setTitle(string $title): static
  54.     {
  55.         $this->title $title;
  56.         return $this;
  57.     }
  58.     public function getDays(): ?string
  59.     {
  60.         return $this->days;
  61.     }
  62.     public function setDays(string $days): static
  63.     {
  64.         $this->days $days;
  65.         return $this;
  66.     }
  67.     public function isIsSystematic(): ?bool
  68.     {
  69.         return $this->isSystematic;
  70.     }
  71.     public function setIsSystematic(bool $isSystematic): static
  72.     {
  73.         $this->isSystematic $isSystematic;
  74.         return $this;
  75.     }
  76.     /**
  77.      * @return Collection<int, Website>
  78.      */
  79.     public function getShops(): Collection
  80.     {
  81.         return $this->shops;
  82.     }
  83.     public function addShop(Website $shop): static
  84.     {
  85.         if (!$this->shops->contains($shop)) {
  86.             $this->shops->add($shop);
  87.             $shop->setCurrentPlan($this);
  88.         }
  89.         return $this;
  90.     }
  91.     public function removeShop(Website $shop): static
  92.     {
  93.         if ($this->shops->removeElement($shop)) {
  94.             // set the owning side to null (unless already changed)
  95.             if ($shop->getCurrentPlan() === $this) {
  96.                 $shop->setCurrentPlan(null);
  97.             }
  98.         }
  99.         return $this;
  100.     }
  101.     /**
  102.      * @return Collection<int, PlanFeature>
  103.      */
  104.     public function getPlanFeatures(): Collection
  105.     {
  106.         return $this->planFeatures;
  107.     }
  108.     public function addPlanFeature(PlanFeature $planFeature): static
  109.     {
  110.         if (!$this->planFeatures->contains($planFeature)) {
  111.             $this->planFeatures->add($planFeature);
  112.             $planFeature->setPlan($this);
  113.         }
  114.         return $this;
  115.     }
  116.     public function removePlanFeature(PlanFeature $planFeature): static
  117.     {
  118.         if ($this->planFeatures->removeElement($planFeature)) {
  119.             // set the owning side to null (unless already changed)
  120.             if ($planFeature->getPlan() === $this) {
  121.                 $planFeature->setPlan(null);
  122.             }
  123.         }
  124.         return $this;
  125.     }
  126.     public function isIsTrial(): ?bool
  127.     {
  128.         return $this->isTrial;
  129.     }
  130.     public function setIsTrial(bool $isTrial): static
  131.     {
  132.         $this->isTrial $isTrial;
  133.         return $this;
  134.     }
  135.     public function getPrice(): ?string
  136.     {
  137.         return $this->price;
  138.     }
  139.     public function setPrice(string $price): static
  140.     {
  141.         $this->price $price;
  142.         return $this;
  143.     }
  144.     /**
  145.      * @return Collection<int, AddOn>
  146.      */
  147.     public function getAddOns(): Collection
  148.     {
  149.         return $this->addOns;
  150.     }
  151.     public function addAddOn(AddOn $addOn): static
  152.     {
  153.         if (!$this->addOns->contains($addOn)) {
  154.             $this->addOns->add($addOn);
  155.             $addOn->setPlan($this);
  156.         }
  157.         return $this;
  158.     }
  159.     public function removeAddOn(AddOn $addOn): static
  160.     {
  161.         if ($this->addOns->removeElement($addOn)) {
  162.             // set the owning side to null (unless already changed)
  163.             if ($addOn->getPlan() === $this) {
  164.                 $addOn->setPlan(null);
  165.             }
  166.         }
  167.         return $this;
  168.     }
  169.     public function hasFeature(string $featureKey): bool
  170.     {
  171.         foreach ($this->planFeatures as $planFeature) {
  172.             $feature $planFeature->getFeature();
  173.             if ($feature && $feature->getFeatureKey() === $featureKey) {
  174.                 return true;
  175.             }
  176.         }
  177.         return false;
  178.     }
  179.     public function getFeatureValue(string $featureKey): ?string
  180.     {
  181.         foreach ($this->planFeatures as $planFeature) {
  182.             $feature $planFeature->getFeature();
  183.             if ($feature && $feature->getFeatureKey() === $featureKey) {
  184.                 return $planFeature->getValue();
  185.             }
  186.         }
  187.         return null;
  188.     }
  189.     public function getFreeIrDomain(): ?int
  190.     {
  191.         return $this->freeIrDomain;
  192.     }
  193.     public function setFreeIrDomain(?int $freeIrDomain): static
  194.     {
  195.         $this->freeIrDomain $freeIrDomain;
  196.         return $this;
  197.     }
  198. }