src/Entity/Familles.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FamillesRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassFamillesRepository::class)]
  8. class Familles
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255nullabletrue)]
  15.     private ?string $nom null;
  16.     #[ORM\OneToMany(mappedBy'familles'targetEntityFamillesdarticles::class, cascade: ["remove"])]
  17.     private Collection $amillesdarticles;
  18.     #[ORM\OneToMany(mappedBy'familles'targetEntityArchivearticle::class, cascade: ["remove"])]
  19.     private Collection $archivearticles;
  20.     public function __toString()
  21.     {
  22.         return $this->getNom(); // Remplacez "getName()" par la méthode ou la propriété appropriée
  23.     }
  24.     public function __construct()
  25.     {
  26.         $this->amillesdarticles = new ArrayCollection();
  27.         $this->archivearticles = new ArrayCollection();
  28.     }
  29.     public function getId(): ?int
  30.     {
  31.         return $this->id;
  32.     }
  33.     public function getNom(): ?string
  34.     {
  35.         return $this->nom;
  36.     }
  37.     public function setNom(?string $nom): self
  38.     {
  39.         $this->nom $nom;
  40.         return $this;
  41.     }
  42.     /**
  43.      * @return Collection<int, Famillesdarticles>
  44.      */
  45.     public function getAmillesdarticles(): Collection
  46.     {
  47.         return $this->amillesdarticles;
  48.     }
  49.     public function addAmillesdarticle(Famillesdarticles $amillesdarticle): self
  50.     {
  51.         if (!$this->amillesdarticles->contains($amillesdarticle)) {
  52.             $this->amillesdarticles->add($amillesdarticle);
  53.             $amillesdarticle->setFamilles($this);
  54.         }
  55.         return $this;
  56.     }
  57.     public function removeAmillesdarticle(Famillesdarticles $amillesdarticle): self
  58.     {
  59.         if ($this->amillesdarticles->removeElement($amillesdarticle)) {
  60.             // set the owning side to null (unless already changed)
  61.             if ($amillesdarticle->getFamilles() === $this) {
  62.                 $amillesdarticle->setFamilles(null);
  63.             }
  64.         }
  65.         return $this;
  66.     }
  67.     /**
  68.      * @return Collection<int, Archivearticle>
  69.      */
  70.     public function getArchivearticles(): Collection
  71.     {
  72.         return $this->archivearticles;
  73.     }
  74.     public function addArchivearticle(Archivearticle $archivearticle): static
  75.     {
  76.         if (!$this->archivearticles->contains($archivearticle)) {
  77.             $this->archivearticles->add($archivearticle);
  78.             $archivearticle->setFamilles($this);
  79.         }
  80.         return $this;
  81.     }
  82.     public function removeArchivearticle(Archivearticle $archivearticle): static
  83.     {
  84.         if ($this->archivearticles->removeElement($archivearticle)) {
  85.             // set the owning side to null (unless already changed)
  86.             if ($archivearticle->getFamilles() === $this) {
  87.                 $archivearticle->setFamilles(null);
  88.             }
  89.         }
  90.         return $this;
  91.     }
  92. }