src/Entity/TypeOrganisation.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClass\App\Repository\TypeOrganisationRepository::class)]
  7. class TypeOrganisation implements \Stringable
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type'integer')]
  12.     private ?int $id 0;
  13.     #[ORM\Column(type'string'length255nullabletrue)]
  14.     private ?string $namenull;
  15.     #[ORM\OneToMany(targetEntity\App\Entity\Organization::class, mappedBy'type_organisation')]
  16.     private mixed $organizations;
  17.     #[ORM\Column(type'string'length255nullabletrue)]
  18.     private ?string $titre_listenull;
  19.     #[ORM\Column(type'integer'nullabletrue)]
  20.     private ?int $ordre;
  21.     public function __construct()
  22.     {
  23.         $this->organizations = new ArrayCollection();
  24.     }
  25.     public function getId(): ?int
  26.     {
  27.         return $this->id;
  28.     }
  29.     public function getName(): ?string
  30.     {
  31.         return $this->name;
  32.     }
  33.     public function setName(?string $name): self
  34.     {
  35.         $this->name $name;
  36.         return $this;
  37.     }
  38.     public function __toString(): string
  39.     {
  40.         return (string) $this->name;
  41.     }
  42.     /**
  43.      * @return Collection|Organization[]
  44.      */
  45.     public function getOrganizations(): Collection
  46.     {
  47.         return $this->organizations;
  48.     }
  49.     public function addOrganization(Organization $organization): self
  50.     {
  51.         if (!$this->organizations->contains($organization)) {
  52.             $this->organizations[] = $organization;
  53.             $organization->setTypeOrganisation($this);
  54.         }
  55.         return $this;
  56.     }
  57.     public function removeOrganization(Organization $organization): self
  58.     {
  59.         if ($this->organizations->contains($organization)) {
  60.             $this->organizations->removeElement($organization);
  61.             // set the owning side to null (unless already changed)
  62.             if ($organization->getTypeOrganisation() === $this) {
  63.                 $organization->setTypeOrganisation(null);
  64.             }
  65.         }
  66.         return $this;
  67.     }
  68.     public function getTitreListe(): ?string
  69.     {
  70.         return $this->titre_liste;
  71.     }
  72.     public function setTitreListe(?string $titre_liste): self
  73.     {
  74.         $this->titre_liste $titre_liste;
  75.         return $this;
  76.     }
  77.     public function getOrdre(): ?int
  78.     {
  79.         return $this->ordre;
  80.     }
  81.     public function setOrdre(?int $ordre): self
  82.     {
  83.         $this->ordre $ordre;
  84.         return $this;
  85.     }
  86. }