src/Entity/Variable.php line 14
<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiResource;use App\Repository\VariableRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: VariableRepository::class)]#[ApiResource]class Variable{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 100)]private ?string $name = null;#[ORM\Column(length: 20)]private ?string $abreviation = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $varFunction = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $varDefinition = null;#[ORM\ManyToOne(inversedBy: 'variables')]#[ORM\JoinColumn(nullable: false)]private ?Units $units = null;#[ORM\OneToMany(mappedBy: 'productVariable', targetEntity: Product::class, orphanRemoval: true)]private Collection $products;#[ORM\OneToMany(mappedBy: 'variable', targetEntity: ProviderDatabaseVariable::class, orphanRemoval: true)]private Collection $providerDatabaseVariables;#[ORM\OneToMany(mappedBy: 'variable', targetEntity: Observation::class, orphanRemoval: true)]private Collection $observations;public function __construct(){$this->products = new ArrayCollection();$this->providerDatabaseVariables = new ArrayCollection();$this->observations = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getName(): ?string{return $this->name;}public function setName(string $name): self{$this->name = $name;return $this;}public function getAbreviation(): ?string{return $this->abreviation;}public function setAbreviation(string $abreviation): self{$this->abreviation = $abreviation;return $this;}public function getVarFunction(): ?string{return $this->varFunction;}public function setVarFunction(?string $varFunction): self{$this->varFunction = $varFunction;return $this;}public function getVarDefinition(): ?string{return $this->varDefinition;}public function setVarDefinition(?string $varDefinition): self{$this->varDefinition = $varDefinition;return $this;}public function getUnits(): ?Units{return $this->units;}public function setUnits(?Units $units): self{$this->units = $units;return $this;}/*** @return Collection<int, Product>*/public function getProducts(): Collection{return $this->products;}public function addProduct(Product $product): self{if (!$this->products->contains($product)) {$this->products->add($product);$product->setProductVariable($this);}return $this;}public function removeProduct(Product $product): self{if ($this->products->removeElement($product)) {// set the owning side to null (unless already changed)if ($product->getProductVariable() === $this) {$product->setProductVariable(null);}}return $this;}/*** @return Collection<int, ProviderDatabaseVariable>*/public function getProviderDatabaseVariables(): Collection{return $this->providerDatabaseVariables;}public function addProviderDatabaseVariable(ProviderDatabaseVariable $providerDatabaseVariable): self{if (!$this->providerDatabaseVariables->contains($providerDatabaseVariable)) {$this->providerDatabaseVariables->add($providerDatabaseVariable);$providerDatabaseVariable->setVariable($this);}return $this;}public function removeProviderDatabaseVariable(ProviderDatabaseVariable $providerDatabaseVariable): self{if ($this->providerDatabaseVariables->removeElement($providerDatabaseVariable)) {// set the owning side to null (unless already changed)if ($providerDatabaseVariable->getVariable() === $this) {$providerDatabaseVariable->setVariable(null);}}return $this;}/*** @return Collection<int, Observation>*/public function getObservations(): Collection{return $this->observations;}public function addObservation(Observation $observation): self{if (!$this->observations->contains($observation)) {$this->observations->add($observation);$observation->setVariable($this);}return $this;}public function removeObservation(Observation $observation): self{if ($this->observations->removeElement($observation)) {// set the owning side to null (unless already changed)if ($observation->getVariable() === $this) {$observation->setVariable(null);}}return $this;}}