<?phpnamespace App\Entity;use App\Repository\LocaliteRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;use Symfony\Component\Validator\Constraints as Assert;use App\Validator as CustomAssert;/** * @ORM\Entity(repositoryClass=LocaliteRepository::class) */class Localite extends EntityBase{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\OneToMany(targetEntity=Poste::class, mappedBy="localite") */ private $postes; /** * @ORM\OneToMany(targetEntity=PosteDirector::class, mappedBy="localite") */ private $posteDirectors; /** * @CustomAssert\Coordinates(groups={"creationLocalite"}) * @ORM\Column(type="text", nullable=true) * @Assert\NotBlank(groups={"creationLocalite","Localite"}) */ private $coordinates; /** * @ORM\Column(type="boolean", nullable=true) */ private $hasCoordinates; /** * @ORM\ManyToOne(targetEntity=ResListeDeChoix::class) * @Assert\NotBlank(groups="Localite") */ private $typeCoordinates; /** * @Groups("api") * @ORM\ManyToOne(targetEntity=ResListeDeChoix::class) * @ORM\JoinColumn(nullable=false) * @Assert\NotBlank(groups="Localite") */ private $type; /** * @ORM\Column(type="integer", nullable=true) */ private $ordre; public function __construct() { $this->postes = new ArrayCollection(); $this->posteDirectors = new ArrayCollection(); } public function getId(): ?int { return $this->id; } /** * @return Collection<int, Poste> */ public function getPostes(): Collection { return $this->postes; } public function addPoste(Poste $poste): self { if (!$this->postes->contains($poste)) { $this->postes[] = $poste; $poste->setLocalite($this); } return $this; } public function removePoste(Poste $poste): self { if ($this->postes->removeElement($poste)) { // set the owning side to null (unless already changed) if ($poste->getLocalite() === $this) { $poste->setLocalite(null); } } return $this; } /** * @return Collection<int, PosteDirector> */ public function getPosteDirectors(): Collection { return $this->posteDirectors; } public function addPosteDirector(PosteDirector $posteDirector): self { if (!$this->posteDirectors->contains($posteDirector)) { $this->posteDirectors[] = $posteDirector; $posteDirector->setLocalite($this); } return $this; } public function removePosteDirector(PosteDirector $posteDirector): self { if ($this->posteDirectors->removeElement($posteDirector)) { // set the owning side to null (unless already changed) if ($posteDirector->getLocalite() === $this) { $posteDirector->setLocalite(null); } } return $this; } public function getCoordinates(): ?string { return $this->coordinates; } public function setCoordinates(?string $coordinates): self { $this->coordinates = $coordinates; return $this; } public function isHasCoordinates(): ?bool { return $this->hasCoordinates; } public function setHasCoordinates(?bool $hasCoordinates): self { $this->hasCoordinates = $hasCoordinates; return $this; } public function getTypeCoordinates(): ?ResListeDeChoix { return $this->typeCoordinates; } public function setTypeCoordinates(?ResListeDeChoix $typeCoordinates): self { $this->typeCoordinates = $typeCoordinates; return $this; } public function getType(): ?ResListeDeChoix { return $this->type; } public function setType(?ResListeDeChoix $type): self { $this->type = $type; return $this; } public function getOrdre(): ?int { return $this->ordre; } public function setOrdre(?int $ordre): self { $this->ordre = $ordre; return $this; }}