<?phpnamespace App\Entity;use App\Repository\UniversityRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: UniversityRepository::class)]class University{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] private $id; #[ORM\Column(type: 'string', length: 255)] private $name; #[ORM\Column(type: 'string', length: 255)] private $address; #[ORM\OneToMany(targetEntity: User::class, mappedBy: 'university')] private $users; #[ORM\ManyToMany(targetEntity: Accreditation::class)] private $accreditation; public function __construct() { $this->users = new ArrayCollection(); $this->accreditation = new ArrayCollection(); } public function __toString() { return $this->name; } 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 getAddress(): ?string { return $this->address; } public function setAddress(string $address): self { $this->address = $address; return $this; } /** * @return Collection|User[] */ public function getUsers(): Collection { return $this->users; } public function addUser(User $user): self { if (!$this->users->contains($user)) { $this->users[] = $user; $user->setUniversity($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->getUniversity() === $this) { $user->setUniversity(null); } } return $this; } /** * @return Collection|Accreditation[] */ public function getAccreditation(): Collection { return $this->accreditation; } public function addAccreditation(Accreditation $accreditation): self { if (!$this->accreditation->contains($accreditation)) { $this->accreditation[] = $accreditation; } return $this; } public function removeAccreditation(Accreditation $accreditation): self { $this->accreditation->removeElement($accreditation); return $this; }}