src/Entity/Variable.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\VariableRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. /**
  10.  * @ORM\Entity(repositoryClass=VariableRepository::class)
  11.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  12.  */
  13. class Variable extends BaseEntity
  14. {
  15.     use SoftDeleteableEntity;
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $name;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $definition;
  30.     /**
  31.      * @ORM\ManyToOne(targetEntity=BPModel::class, inversedBy="variables")
  32.      */
  33.     private $bPModel;
  34.     /**
  35.      * @ORM\Column(type="string", length=255, nullable=true)
  36.      */
  37.     private $value;
  38.     /**
  39.      * @ORM\Column(type="string", length=255, nullable=true)
  40.      */
  41.     private $type;
  42.     /**
  43.      * @ORM\OneToMany(targetEntity=VariableValues::class, mappedBy="variable")
  44.      */
  45.     private $variableValues;
  46.     /**
  47.      * @ORM\ManyToMany(targetEntity=CustomerBP::class, mappedBy="variables")
  48.      */
  49.     private $customerBPs;
  50.     /**
  51.      * @ORM\ManyToMany(targetEntity=Role::class, mappedBy="variables")
  52.      */
  53.     private $roles;
  54.     /**
  55.      * @ORM\OneToMany(targetEntity=CustomerVariable::class, mappedBy="variable")
  56.      */
  57.     private $customerVariables;
  58.     /**
  59.      * @ORM\Column(type="boolean", nullable=true)
  60.      */
  61.     private $isFree false;
  62.     /**
  63.      * @ORM\ManyToOne(targetEntity=Subscription::class)
  64.      * @ORM\JoinColumn(nullable=true)
  65.      */
  66.     private $subscription;
  67.     public function __construct()
  68.     {
  69.         $this->variableValues = new ArrayCollection();
  70.         $this->customerBPs = new ArrayCollection();
  71.         $this->roles = new ArrayCollection();
  72.         $this->customerVariables = new ArrayCollection();
  73.     }
  74.     public function getId(): ?int
  75.     {
  76.         return $this->id;
  77.     }
  78.     public function getName(): ?string
  79.     {
  80.         return $this->name;
  81.     }
  82.     public function setName(string $name): self
  83.     {
  84.         $this->name $name;
  85.         return $this;
  86.     }
  87.     public function getDefinition(): ?string
  88.     {
  89.         return $this->definition;
  90.     }
  91.     public function setDefinition(?string $definition): self
  92.     {
  93.         $this->definition $definition;
  94.         return $this;
  95.     }
  96.     public function getBPModel(): ?BPModel
  97.     {
  98.         return $this->bPModel;
  99.     }
  100.     public function setBPModel(?BPModel $bPModel): self
  101.     {
  102.         $this->bPModel $bPModel;
  103.         return $this;
  104.     }
  105.     public function getValue(): ?string
  106.     {
  107.         return $this->value;
  108.     }
  109.     public function setValue(?string $value): self
  110.     {
  111.         $this->value $value;
  112.         return $this;
  113.     }
  114.     public function getType(): ?string
  115.     {
  116.         return $this->type;
  117.     }
  118.     public function setType(?string $type): self
  119.     {
  120.         $this->type $type;
  121.         return $this;
  122.     }
  123.     /**
  124.      * @return Collection<int, VariableValues>
  125.      */
  126.     public function getVariableValues(): Collection
  127.     {
  128.         return $this->variableValues;
  129.     }
  130.     public function addVariableValue(VariableValues $variableValue): self
  131.     {
  132.         if (!$this->variableValues->contains($variableValue)) {
  133.             $this->variableValues[] = $variableValue;
  134.             $variableValue->setVariable($this);
  135.         }
  136.         return $this;
  137.     }
  138.     public function removeVariableValue(VariableValues $variableValue): self
  139.     {
  140.         if ($this->variableValues->removeElement($variableValue)) {
  141.             // set the owning side to null (unless already changed)
  142.             if ($variableValue->getVariable() === $this) {
  143.                 $variableValue->setVariable(null);
  144.             }
  145.         }
  146.         return $this;
  147.     }
  148.     /**
  149.      * @return Collection<int, CustomerBP>
  150.      */
  151.     public function getCustomerBPs(): Collection
  152.     {
  153.         return $this->customerBPs;
  154.     }
  155.     public function addCustomerBP(CustomerBP $customerBP): self
  156.     {
  157.         if (!$this->customerBPs->contains($customerBP)) {
  158.             $this->customerBPs[] = $customerBP;
  159.             $customerBP->addVariable($this);
  160.         }
  161.         return $this;
  162.     }
  163.     public function removeCustomerBP(CustomerBP $customerBP): self
  164.     {
  165.         if ($this->customerBPs->removeElement($customerBP)) {
  166.             $customerBP->removeVariable($this);
  167.         }
  168.         return $this;
  169.     }
  170.     /**
  171.      * @return Collection<int, Role>
  172.      */
  173.     public function getRoles(): Collection
  174.     {
  175.         return $this->roles;
  176.     }
  177.     public function addRole(Role $role): self
  178.     {
  179.         if (!$this->roles->contains($role)) {
  180.             $this->roles[] = $role;
  181.             $role->addVariable($this);
  182.         }
  183.         return $this;
  184.     }
  185.     public function removeRole(Role $role): self
  186.     {
  187.         if ($this->roles->removeElement($role)) {
  188.             $role->removeVariable($this);
  189.         }
  190.         return $this;
  191.     }
  192.     /**
  193.      * @return Collection<int, CustomerVariable>
  194.      */
  195.     public function getCustomerVariables(): Collection
  196.     {
  197.         return $this->customerVariables;
  198.     }
  199.     public function addCustomerVariable(CustomerVariable $customerVariable): self
  200.     {
  201.         if (!$this->customerVariables->contains($customerVariable)) {
  202.             $this->customerVariables[] = $customerVariable;
  203.             $customerVariable->setVariable($this);
  204.         }
  205.         return $this;
  206.     }
  207.     public function removeCustomerVariable(CustomerVariable $customerVariable): self
  208.     {
  209.         if ($this->customerVariables->removeElement($customerVariable)) {
  210.             // set the owning side to null (unless already changed)
  211.             if ($customerVariable->getVariable() === $this) {
  212.                 $customerVariable->setVariable(null);
  213.             }
  214.         }
  215.         return $this;
  216.     }
  217.     public function isFree(): ?bool
  218.     {
  219.         return $this->isFree;
  220.     }
  221.     public function getIsFree(): ?bool
  222.     {
  223.         return $this->isFree;
  224.     }
  225.     public function setIsFree(?bool $isFree): self
  226.     {
  227.         $this->isFree $isFree;
  228.         return $this;
  229.     }
  230.     public function getSubscription(): ?Subscription
  231.     {
  232.         return $this->subscription;
  233.     }
  234.     public function setSubscription(?Subscription $subscription): self
  235.     {
  236.         $this->subscription $subscription;
  237.         return $this;
  238.     }
  239. }