src/Entity/BaseSite/Plan/Feature.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\BaseSite\Plan;
  3. use App\Entity\BaseEntity;
  4. use App\Repository\BaseSite\Plan\FeatureRepository;
  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. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  10. #[ORM\Entity(repositoryClassFeatureRepository::class)]
  11. class Feature extends BaseEntity
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\Column(type'guid'uniquetrue)]
  15.     #[ORM\GeneratedValue(strategy'CUSTOM')]
  16.     #[ORM\CustomIdGenerator(class: UuidGenerator::class)]
  17.     private ?string $id;
  18.     #[ORM\Column(length255)]
  19.     private ?string $name null;
  20.     #[ORM\Column(typeTypes::BIGINT)]
  21.     private ?string $pricePerUnit null;
  22.     #[ORM\Column(length255)]
  23.     private ?string $unit null;
  24.     #[ORM\Column(typeTypes::BIGINT)]
  25.     private ?string $pricePerExtraUnit null;
  26.     #[ORM\OneToMany(mappedBy'feature'targetEntityPlanFeature::class)]
  27.     private Collection $planFeatures;
  28.     #[ORM\OneToMany(mappedBy'feature'targetEntityAddOn::class)]
  29.     private Collection $addOns;
  30.     #[ORM\Column(length255)]
  31.     private ?string $valueType 'integer'// یا 'boolean'
  32.     #[ORM\Column(length255)]
  33.     private ?string $featureKey null;
  34.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  35.     private ?string $details null;
  36.     public function __construct()
  37.     {
  38.         parent::__construct();
  39.         $this->planFeatures = new ArrayCollection();
  40.         $this->addOns = new ArrayCollection();
  41.     }
  42.     public function getId(): ?string
  43.     {
  44.         return $this->id;
  45.     }
  46.     public function getName(): ?string
  47.     {
  48.         return $this->name;
  49.     }
  50.     public function setName(string $name): static
  51.     {
  52.         $this->name $name;
  53.         return $this;
  54.     }
  55.     public function getPricePerUnit(): ?string
  56.     {
  57.         return $this->pricePerUnit;
  58.     }
  59.     public function setPricePerUnit(string $pricePerUnit): static
  60.     {
  61.         $this->pricePerUnit $pricePerUnit;
  62.         return $this;
  63.     }
  64.     public function getUnit(): ?string
  65.     {
  66.         return $this->unit;
  67.     }
  68.     public function setUnit(string $unit): static
  69.     {
  70.         $this->unit $unit;
  71.         return $this;
  72.     }
  73.     public function getPricePerExtraUnit(): ?string
  74.     {
  75.         return $this->pricePerExtraUnit;
  76.     }
  77.     public function setPricePerExtraUnit(string $pricePerExtraUnit): static
  78.     {
  79.         $this->pricePerExtraUnit $pricePerExtraUnit;
  80.         return $this;
  81.     }
  82.     /**
  83.      * @return Collection<int, PlanFeature>
  84.      */
  85.     public function getPlanFeatures(): Collection
  86.     {
  87.         return $this->planFeatures;
  88.     }
  89.     public function addPlanFeature(PlanFeature $planFeature): static
  90.     {
  91.         if (!$this->planFeatures->contains($planFeature)) {
  92.             $this->planFeatures->add($planFeature);
  93.             $planFeature->setFeature($this);
  94.         }
  95.         return $this;
  96.     }
  97.     public function removePlanFeature(PlanFeature $planFeature): static
  98.     {
  99.         if ($this->planFeatures->removeElement($planFeature)) {
  100.             // set the owning side to null (unless already changed)
  101.             if ($planFeature->getFeature() === $this) {
  102.                 $planFeature->setFeature(null);
  103.             }
  104.         }
  105.         return $this;
  106.     }
  107.     /**
  108.      * @return Collection<int, AddOn>
  109.      */
  110.     public function getAddOns(): Collection
  111.     {
  112.         return $this->addOns;
  113.     }
  114.     public function addAddOn(AddOn $addOn): static
  115.     {
  116.         if (!$this->addOns->contains($addOn)) {
  117.             $this->addOns->add($addOn);
  118.             $addOn->setFeature($this);
  119.         }
  120.         return $this;
  121.     }
  122.     public function removeAddOn(AddOn $addOn): static
  123.     {
  124.         if ($this->addOns->removeElement($addOn)) {
  125.             // set the owning side to null (unless already changed)
  126.             if ($addOn->getFeature() === $this) {
  127.                 $addOn->setFeature(null);
  128.             }
  129.         }
  130.         return $this;
  131.     }
  132.     public function getFeatureKey(): ?string
  133.     {
  134.         return $this->featureKey;
  135.     }
  136.     public function setFeatureKey(string $featureKey): static
  137.     {
  138.         $this->featureKey $featureKey;
  139.         return $this;
  140.     }
  141.     public function getValueType(): ?string
  142.     {
  143.         return $this->valueType;
  144.     }
  145.     public function setValueType(?string $valueType): void
  146.     {
  147.         $this->valueType $valueType;
  148.     }
  149.     public function getDetails(): ?string
  150.     {
  151.         return $this->details;
  152.     }
  153.     public function setDetails(?string $details): static
  154.     {
  155.         $this->details $details;
  156.         return $this;
  157.     }
  158. }