<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: \App\Repository\TypeOrganisationRepository::class)]
class TypeOrganisation implements \Stringable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private ?int $id = 0;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $name= null;
#[ORM\OneToMany(targetEntity: \App\Entity\Organization::class, mappedBy: 'type_organisation')]
private mixed $organizations;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $titre_liste= null;
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $ordre;
public function __construct()
{
$this->organizations = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function __toString(): string
{
return (string) $this->name;
}
/**
* @return Collection|Organization[]
*/
public function getOrganizations(): Collection
{
return $this->organizations;
}
public function addOrganization(Organization $organization): self
{
if (!$this->organizations->contains($organization)) {
$this->organizations[] = $organization;
$organization->setTypeOrganisation($this);
}
return $this;
}
public function removeOrganization(Organization $organization): self
{
if ($this->organizations->contains($organization)) {
$this->organizations->removeElement($organization);
// set the owning side to null (unless already changed)
if ($organization->getTypeOrganisation() === $this) {
$organization->setTypeOrganisation(null);
}
}
return $this;
}
public function getTitreListe(): ?string
{
return $this->titre_liste;
}
public function setTitreListe(?string $titre_liste): self
{
$this->titre_liste = $titre_liste;
return $this;
}
public function getOrdre(): ?int
{
return $this->ordre;
}
public function setOrdre(?int $ordre): self
{
$this->ordre = $ordre;
return $this;
}
}