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

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