<?phpnamespace App\Entity;use App\Repository\PosteDirectorRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;/** * @ORM\Entity(repositoryClass=PosteDirectorRepository::class) */class PosteDirector extends EntityBase{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\OneToMany(targetEntity=Poste::class, mappedBy="posteDirector") * @Assert\NotBlank() */ private $postes; /** * @ORM\ManyToOne(targetEntity=Employee::class) * @ORM\JoinColumn(nullable=false) * @Assert\NotBlank() */ private $responsable; /** * @ORM\ManyToOne(targetEntity=Localite::class, inversedBy="posteDirectors") * @Assert\NotBlank() */ private $localite; /** * @ORM\OneToMany(targetEntity=Employee::class, mappedBy="posteDirector") */ private $employees; public function __construct() { $this->postes = new ArrayCollection(); $this->employees = 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->setPosteDirector($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->getPosteDirector() === $this) { $poste->setPosteDirector(null); } } return $this; } public function getResponsable(): ?Employee { return $this->responsable; } public function setResponsable(?Employee $responsable): self { $this->responsable = $responsable; return $this; } public function getLocalite(): ?Localite { return $this->localite; } public function setLocalite(?Localite $localite): self { $this->localite = $localite; return $this; } /** * @return Collection<int, Employee> */ public function getEmployees(): Collection { return $this->employees; } public function addEmployee(Employee $employee): self { if (!$this->employees->contains($employee)) { $this->employees[] = $employee; $employee->setPosteDirector($this); } return $this; } public function removeEmployee(Employee $employee): self { if ($this->employees->removeElement($employee)) { // set the owning side to null (unless already changed) if ($employee->getPosteDirector() === $this) { $employee->setPosteDirector(null); } } return $this; }}