src/Entity/TypeOfTypes.php line 15

  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity;
  4. use App\Repository\TypeOfTypesRepository;
  5. use App\Utils\Traits\EntityId_TimestampTrait;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Uid\Ulid;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. #[ORM\Entity(repositoryClassTypeOfTypesRepository::class)]
  11. class TypeOfTypes
  12. {
  13.     use EntityId_TimestampTrait;
  14.     #[ORM\Column(type'string'length200)]
  15.     private $libelle;
  16.     #[ORM\Column(type'string'length200nullabletrue)]
  17.     private $libelleFr;
  18.     #[ORM\ManyToOne(targetEntityself::class)]
  19.     private $parent;
  20.     #[ORM\Column(type'string'length255uniquetrue)]
  21.     private $codereference;
  22.     #[ORM\OneToMany(mappedBy'fonction'targetEntityFonctionUser::class)]
  23.     private Collection $fonctionUsers;
  24.     #[ORM\OneToMany(mappedBy'fonction'targetEntityFonctionAction::class)]
  25.     private Collection $fonctionActions;
  26.     #[ORM\OneToMany(mappedBy'category'targetEntityLibraryAssets::class)]
  27.     private Collection $libraryAssets;
  28.     public function __construct()
  29.     {
  30.         $this->uuid = new Ulid();
  31.         $this->created = new \DateTimeImmutable('now');
  32.         $this->updated = new \DateTime('now');
  33.         $this->deleted false;
  34.         $this->fonctionUsers = new ArrayCollection();
  35.         $this->fonctionActions = new ArrayCollection();
  36.         $this->libraryAssets = new ArrayCollection();
  37.     }
  38.     public function __toString(): string
  39.     {
  40.         return $this->libelle ?? '';
  41.     }
  42.     public function getLibelle(): ?string
  43.     {
  44.         return $this->libelle;
  45.     }
  46.     public function setLibelle(string $libelle): self
  47.     {
  48.         $this->libelle $libelle;
  49.         return $this;
  50.     }
  51.     public function getParent(): ?self
  52.     {
  53.         return $this->parent;
  54.     }
  55.     public function setParent(?self $parent): self
  56.     {
  57.         $this->parent $parent;
  58.         return $this;
  59.     }
  60.     public function getCodereference(): ?string
  61.     {
  62.         return $this->codereference;
  63.     }
  64.     public function setCodereference(string $codereference): self
  65.     {
  66.         $this->codereference $codereference;
  67.         return $this;
  68.     }
  69.     public function getId()
  70.     {
  71.         return $this->id;
  72.     }
  73.     public function getLibelleFr(): ?string
  74.     {
  75.         return $this->libelleFr;
  76.     }
  77.     public function setLibelleFr(?string $libelleFr): self
  78.     {
  79.         $this->libelleFr $libelleFr;
  80.         return $this;
  81.     }
  82.     /**
  83.      * @return Collection<int, FonctionUser>
  84.      */
  85.     public function getFonctionUsers(): Collection
  86.     {
  87.         return $this->fonctionUsers;
  88.     }
  89.     public function addFonctionUser(FonctionUser $fonctionUser): self
  90.     {
  91.         if (!$this->fonctionUsers->contains($fonctionUser)) {
  92.             $this->fonctionUsers->add($fonctionUser);
  93.             $fonctionUser->setFonction($this);
  94.         }
  95.         return $this;
  96.     }
  97.     public function removeFonctionUser(FonctionUser $fonctionUser): self
  98.     {
  99.         if ($this->fonctionUsers->removeElement($fonctionUser)) {
  100.             // set the owning side to null (unless already changed)
  101.             if ($fonctionUser->getFonction() === $this) {
  102.                 $fonctionUser->setFonction(null);
  103.             }
  104.         }
  105.         return $this;
  106.     }
  107.     /**
  108.      * @return Collection<int, FonctionAction>
  109.      */
  110.     public function getFonctionActions(): Collection
  111.     {
  112.         if (!isset($this->fonctionActions)) {
  113.             $this->fonctionActions = new ArrayCollection();
  114.         }
  115.         return $this->fonctionActions;
  116.     }
  117.     public function addFonctionAction(FonctionAction $fonctionAction): self
  118.     {
  119.         if (!$this->fonctionActions->contains($fonctionAction)) {
  120.             $this->fonctionActions->add($fonctionAction);
  121.             $fonctionAction->setFonction($this);
  122.         }
  123.         return $this;
  124.     }
  125.     public function removeFonctionAction(FonctionAction $fonctionAction): self
  126.     {
  127.         if ($this->fonctionActions->removeElement($fonctionAction)) {
  128.             // set the owning side to null (unless already changed)
  129.             if ($fonctionAction->getFonction() === $this) {
  130.                 $fonctionAction->setFonction(null);
  131.             }
  132.         }
  133.         return $this;
  134.     }
  135.     /**
  136.      * @return Collection<int, LibraryAssets>
  137.      */
  138.     public function getLibraryAssets(): Collection
  139.     {
  140.         return $this->libraryAssets;
  141.     }
  142.     public function addLibraryAsset(LibraryAssets $libraryAsset): self
  143.     {
  144.         if (!$this->libraryAssets->contains($libraryAsset)) {
  145.             $this->libraryAssets->add($libraryAsset);
  146.             $libraryAsset->setCategory($this);
  147.         }
  148.         return $this;
  149.     }
  150.     public function removeLibraryAsset(LibraryAssets $libraryAsset): self
  151.     {
  152.         if ($this->libraryAssets->removeElement($libraryAsset)) {
  153.             // set the owning side to null (unless already changed)
  154.             if ($libraryAsset->getCategory() === $this) {
  155.                 $libraryAsset->setCategory(null);
  156.             }
  157.         }
  158.         return $this;
  159.     }
  160. }