<?phpnamespace App\Entity\Company;use Doctrine\ORM\Mapping as ORM;use App\Entity\Company\Juridiction;use App\Entity\Utils\TimestampTrait;use App\Entity\Department\Department;use Doctrine\Common\Collections\Collection;use Doctrine\Common\Collections\ArrayCollection;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;/** * @ORM\Entity(repositoryClass="App\Repository\Company\PresentationRepository") * @UniqueEntity(fields={"name"}, message="Ce nom existe déjà") * @ORM\HasLifecycleCallbacks() */class Presentation{ use TimestampTrait; /** * @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 $abbreviation; /** * @ORM\Column(type="text") */ private $description; /** * @ORM\OneToMany(targetEntity="App\Entity\Company\Juridiction", mappedBy="nature") */ private $juridictions; /** * @ORM\ManyToMany(targetEntity=Department::class, mappedBy="natures") */ private $departments; public function __construct() { $this->juridictions = new ArrayCollection(); $this->departments = 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 getAbbreviation(): ?string { return $this->abbreviation; } public function setAbbreviation(string $abbreviation): self { $this->abbreviation = $abbreviation; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(string $description): self { $this->description = $description; return $this; } /** * @return Collection|Juridiction[] */ public function getJuridictions(): Collection { return $this->juridictions; } public function addJuridiction(Juridiction $juridiction): self { if (!$this->juridictions->contains($juridiction)) { $this->juridictions[] = $juridiction; $juridiction->setNature($this); } return $this; } public function removeJuridiction(Juridiction $juridiction): self { if ($this->juridictions->contains($juridiction)) { $this->juridictions->removeElement($juridiction); // set the owning side to null (unless already changed) if ($juridiction->getNature() === $this) { $juridiction->setNature(null); } } return $this; } /** * @return Collection|Department[] */ public function getDepartments(): Collection { return $this->departments; } public function addDepartment(Department $department): self { if (!$this->departments->contains($department)) { $this->departments[] = $department; $department->addNature($this); } return $this; } public function removeDepartment(Department $department): self { if ($this->departments->contains($department)) { $this->departments->removeElement($department); $department->removeNature($this); } return $this; }}