<?php
namespace App\Entity;
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)]
class Variable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $label = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $type = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $valeur_possible = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $valeur_defaut = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $date_creation = null;
#[ORM\ManyToOne(inversedBy: 'variables')]
private ?VariablesGroup $variable_group = null;
#[ORM\OneToMany(mappedBy: 'variable', targetEntity: VariableValue::class, cascade: ['remove', 'persist'])]
private Collection $variableValues;
#[ORM\Column(nullable: true)]
private ?int $ordre = null;
#[ORM\Column(length: 20, nullable: true)]
private ?string $unite = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $config = null;
#[ORM\ManyToOne(inversedBy: 'variables')]
private ?User $userr = null;
public function __construct()
{
$this->variableValues = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): static
{
$this->label = $label;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): static
{
$this->type = $type;
return $this;
}
public function getValeurPossible(): ?string
{
return $this->valeur_possible;
}
public function setValeurPossible(string $valeur_possible): static
{
$this->valeur_possible = $valeur_possible;
return $this;
}
public function getValeurDefaut(): ?string
{
return $this->valeur_defaut;
}
public function setValeurDefaut(string $valeur_defaut): static
{
$this->valeur_defaut = $valeur_defaut;
return $this;
}
public function getDateCreation(): ?\DateTimeInterface
{
return $this->date_creation;
}
public function setDateCreation(\DateTimeInterface $date_creation): static
{
$this->date_creation = $date_creation;
return $this;
}
public function getVariableGroup(): ?VariablesGroup
{
return $this->variable_group;
}
public function setVariableGroup(?VariablesGroup $variable_group): static
{
$this->variable_group = $variable_group;
return $this;
}
/**
* @return Collection<int, VariableValue>
*/
public function getVariableValues(): Collection
{
return $this->variableValues;
}
public function addVariableValue(VariableValue $variableValue): static
{
if (!$this->variableValues->contains($variableValue)) {
$this->variableValues->add($variableValue);
$variableValue->setVariable($this);
}
return $this;
}
public function removeVariableValue(VariableValue $variableValue): static
{
if ($this->variableValues->removeElement($variableValue)) {
// set the owning side to null (unless already changed)
if ($variableValue->getVariable() === $this) {
$variableValue->setVariable(null);
}
}
return $this;
}
public function getOrdre(): ?int
{
return $this->ordre;
}
public function setOrdre(?int $ordre): static
{
$this->ordre = $ordre;
return $this;
}
public function getUnite(): ?string
{
return $this->unite;
}
public function setUnite(?string $unite): static
{
$this->unite = $unite;
return $this;
}
public function getConfig(): ?string
{
return $this->config;
}
public function setConfig(?string $config): static
{
$this->config = $config;
return $this;
}
public function getUserr(): ?User
{
return $this->userr;
}
public function setUserr(?User $userr): static
{
$this->userr = $userr;
return $this;
}
}