src/Entity/VariablesGroup.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\VariablesGroupRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassVariablesGroupRepository::class)]
  9. #[ORM\Index(name'idx_variables_group_societe'columns: ['societe'])]
  10. class VariablesGroup
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length255)]
  17.     private ?string $label null;
  18.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  19.     private ?\DateTimeInterface $date_creation null;
  20.     #[ORM\Column(typeTypes::INTEGERoptions: ['default' => 1])]
  21.     private int $etat 1;
  22.     #[ORM\Column(typeTypes::BOOLEANnullabletrue)]
  23.     private ?bool $contact null;
  24.     #[ORM\Column(typeTypes::BOOLEANnullabletrue)]
  25.     private ?bool $objet null;
  26.     #[ORM\OneToMany(mappedBy'variable_group'targetEntityVariable::class, cascade: ['remove''persist'])]
  27.     private Collection $variables;
  28.     #[ORM\OneToMany(mappedBy'attributGroupe'targetEntityAttributGroupeLiaison::class, cascade: ['remove''persist'])]
  29.     #[ORM\OrderBy(['colonne' => 'ASC''ordre' => 'ASC'])]
  30.     private Collection $attributGroupeLiaisons;
  31.     #[ORM\Column(nullabletrue)]
  32.     private ?bool $societe null;
  33.     #[ORM\Column(nullabletrue)]
  34.     private ?bool $utilisateur null;
  35.     #[ORM\ManyToOne(inversedBy'variablesGroups')]
  36.     private ?Document $document null;
  37.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  38.     private ?string $icone null;
  39.     #[ORM\Column(typeTypes::BOOLEANoptions: ['default' => false])]
  40.     private bool $actif_fiche false;
  41.     #[ORM\Column(typeTypes::BOOLEANoptions: ['default' => false])]
  42.     private bool $actif_liste false;
  43.     public function __construct()
  44.     {
  45.         $this->variables = new ArrayCollection();
  46.         $this->attributGroupeLiaisons = new ArrayCollection();
  47.     }
  48.     public function getId(): ?int
  49.     {
  50.         return $this->id;
  51.     }
  52.     public function getLabel(): ?string
  53.     {
  54.         return $this->label;
  55.     }
  56.     public function setLabel(string $label): static
  57.     {
  58.         $this->label $label;
  59.         return $this;
  60.     }
  61.     public function getColonne(): int
  62.     {
  63.         if ($this->societe || $this->utilisateur || $this->document) {
  64.             return 1;
  65.         }
  66.         if (!$this->attributGroupeLiaisons->isEmpty()) {
  67.             $firstLiaison $this->attributGroupeLiaisons->first();
  68.             return $firstLiaison->getColonne() ?? 1;
  69.         }
  70.         return 1;
  71.     }
  72.     public function getDateCreation(): ?\DateTimeInterface
  73.     {
  74.         return $this->date_creation;
  75.     }
  76.     public function setDateCreation(\DateTimeInterface $date_creation): static
  77.     {
  78.         $this->date_creation $date_creation;
  79.         return $this;
  80.     }
  81.     public function getVariables(): Collection
  82.     {
  83.         return $this->variables;
  84.     }
  85.     public function addVariable(Variable $variable): static
  86.     {
  87.         if (!$this->variables->contains($variable)) {
  88.             $this->variables->add($variable);
  89.             $variable->setVariableGroup($this);
  90.         }
  91.         return $this;
  92.     }
  93.     public function removeVariable(Variable $variable): static
  94.     {
  95.         if ($this->variables->removeElement($variable)) {
  96.             if ($variable->getVariableGroup() === $this) {
  97.                 $variable->setVariableGroup(null);
  98.             }
  99.         }
  100.         return $this;
  101.     }
  102.     public function getAttributGroupeLiaisons(): Collection
  103.     {
  104.         return $this->attributGroupeLiaisons;
  105.     }
  106.     public function addAttributGroupeLiaison(AttributGroupeLiaison $attributGroupeLiaison): static
  107.     {
  108.         if (!$this->attributGroupeLiaisons->contains($attributGroupeLiaison)) {
  109.             $this->attributGroupeLiaisons->add($attributGroupeLiaison);
  110.             $attributGroupeLiaison->setAttributGroupe($this);
  111.         }
  112.         return $this;
  113.     }
  114.     public function removeAttributGroupeLiaison(AttributGroupeLiaison $attributGroupeLiaison): static
  115.     {
  116.         if ($this->attributGroupeLiaisons->removeElement($attributGroupeLiaison)) {
  117.             if ($attributGroupeLiaison->getAttributGroupe() === $this) {
  118.                 $attributGroupeLiaison->setAttributGroupe(null);
  119.             }
  120.         }
  121.         return $this;
  122.     }
  123.     public function getContactTypes(): Collection
  124.     {
  125.         $contactTypes = new ArrayCollection();
  126.         foreach ($this->attributGroupeLiaisons as $liaison) {
  127.             if ($liaison->getContactType() !== null) {
  128.                 $contactTypes->add($liaison->getContactType());
  129.             }
  130.         }
  131.         return $contactTypes;
  132.     }
  133.     public function getObjetTypes(): Collection
  134.     {
  135.         $objetTypes = new ArrayCollection();
  136.         foreach ($this->attributGroupeLiaisons as $liaison) {
  137.             if ($liaison->getObjetType() !== null) {
  138.                 $objetTypes->add($liaison->getObjetType());
  139.             }
  140.         }
  141.         return $objetTypes;
  142.     }
  143.     public function getContactGroup(): Collection
  144.     {
  145.         return $this->getContactTypes();
  146.     }
  147.     public function getObjetGroup(): Collection
  148.     {
  149.         return $this->getObjetTypes();
  150.     }
  151.     public function isSociete(): ?bool
  152.     {
  153.         return $this->societe;
  154.     }
  155.     public function setSociete(?bool $societe): static
  156.     {
  157.         $this->societe $societe;
  158.         return $this;
  159.     }
  160.     public function isUtilisateur(): ?bool
  161.     {
  162.         return $this->utilisateur;
  163.     }
  164.     public function setUtilisateur(?bool $utilisateur): static
  165.     {
  166.         $this->utilisateur $utilisateur;
  167.         return $this;
  168.     }
  169.     public function getDocument(): ?Document
  170.     {
  171.         return $this->document;
  172.     }
  173.     public function setDocument(?Document $document): static
  174.     {
  175.         $this->document $document;
  176.         return $this;
  177.     }
  178.     public function getEtat(): int
  179.     {
  180.         return $this->etat;
  181.     }
  182.     public function setEtat(int $etat): static
  183.     {
  184.         $this->etat $etat;
  185.         return $this;
  186.     }
  187.     public function isContact(): ?bool
  188.     {
  189.         return $this->contact;
  190.     }
  191.     public function setContact(?bool $contact): static
  192.     {
  193.         $this->contact $contact;
  194.         return $this;
  195.     }
  196.     public function isObjet(): ?bool
  197.     {
  198.         return $this->objet;
  199.     }
  200.     public function setObjet(?bool $objet): static
  201.     {
  202.         $this->objet $objet;
  203.         return $this;
  204.     }
  205.     public function getIcone(): ?string
  206.     {
  207.         return $this->icone;
  208.     }
  209.     public function setIcone(?string $icone): static
  210.     {
  211.         $this->icone $icone trim($icone) : null;
  212.         return $this;
  213.     }
  214.     public function isActifFiche(): bool
  215.     {
  216.         return $this->actif_fiche;
  217.     }
  218.     public function setActifFiche(bool $actif_fiche): static
  219.     {
  220.         $this->actif_fiche $actif_fiche;
  221.         return $this;
  222.     }
  223.     public function isActifListe(): bool
  224.     {
  225.         return $this->actif_liste;
  226.     }
  227.     public function setActifListe(bool $actif_liste): static
  228.     {
  229.         $this->actif_liste $actif_liste;
  230.         return $this;
  231.     }
  232. }