<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiResource;use App\Repository\EtablissementRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: EtablissementRepository::class)]#[ApiResource]class Etablissement{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255, nullable: true)] private ?string $name = null; #[ORM\Column(length: 500, nullable: true)] private ?string $url = null; #[ORM\OneToMany(mappedBy: 'etablissement', targetEntity: User::class)] private Collection $users; #[ORM\OneToMany(mappedBy: 'etablissement', targetEntity: CompteRendu::class)] private Collection $compteRendus; public function __toString() { return $this->name; } public function __construct() { $this->users = new ArrayCollection(); $this->compteRendus = 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 getUrl(): ?string { return $this->url; } public function setUrl(?string $url): self { $this->url = $url; return $this; } /** * @return Collection<int, User> */ public function getUsers(): Collection { return $this->users; } public function addUser(User $user): self { if (!$this->users->contains($user)) { $this->users->add($user); $user->setEtablissement($this); } return $this; } public function removeUser(User $user): self { if ($this->users->removeElement($user)) { // set the owning side to null (unless already changed) if ($user->getEtablissement() === $this) { $user->setEtablissement(null); } } return $this; } /** * @return Collection<int, CompteRendu> */ public function getCompteRendus(): Collection { return $this->compteRendus; } public function addCompteRendu(CompteRendu $compteRendu): self { if (!$this->compteRendus->contains($compteRendu)) { $this->compteRendus->add($compteRendu); $compteRendu->setEtablissement($this); } return $this; } public function removeCompteRendu(CompteRendu $compteRendu): self { if ($this->compteRendus->removeElement($compteRendu)) { // set the owning side to null (unless already changed) if ($compteRendu->getEtablissement() === $this) { $compteRendu->setEtablissement(null); } } return $this; }}