src/Entity/Zone.php line 13
<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiResource;use App\Repository\ZoneRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: ZoneRepository::class)]#[ApiResource]class Zone{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 100)]private ?string $name = null;#[ORM\ManyToOne(inversedBy: 'zones')]#[ORM\JoinColumn(nullable: false)]private ?Country $country = null;#[ORM\OneToMany(mappedBy: 'zone', targetEntity: Users::class, orphanRemoval: true)]private Collection $users;#[ORM\OneToMany(mappedBy: 'zone', targetEntity: Station::class, orphanRemoval: true)]private Collection $stations;public function __construct(){$this->users = new ArrayCollection();$this->stations = 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 getCountry(): ?Country{return $this->country;}public function setCountry(?Country $country): self{$this->country = $country;return $this;}/*** @return Collection<int, Users>*/public function getUsers(): Collection{return $this->users;}public function addUser(Users $user): self{if (!$this->users->contains($user)) {$this->users->add($user);$user->setZone($this);}return $this;}public function removeUser(Users $user): self{if ($this->users->removeElement($user)) {// set the owning side to null (unless already changed)if ($user->getZone() === $this) {$user->setZone(null);}}return $this;}/*** @return Collection<int, Station>*/public function getStations(): Collection{return $this->stations;}public function addStation(Station $station): self{if (!$this->stations->contains($station)) {$this->stations->add($station);$station->setZone($this);}return $this;}public function removeStation(Station $station): self{if ($this->stations->removeElement($station)) {// set the owning side to null (unless already changed)if ($station->getZone() === $this) {$station->setZone(null);}}return $this;}}