<?phpnamespace App\Entity;use App\Repository\DepartmentRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;/** * @ORM\Entity(repositoryClass=DepartmentRepository::class) */class Department{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $name = ""; /** * @ORM\ManyToOne(targetEntity=TvCompany::class, inversedBy="departments") */ private $tvCompany = null; /** * @ORM\Column(type="datetime") * @Gedmo\Timestampable(on="create") */ private $createdAt; /** * @ORM\OneToMany(targetEntity=TvUser::class, mappedBy="department") */ private $tvUsers = []; /** * @ORM\OneToOne(targetEntity=Segmentation::class, inversedBy="department") */ private $segmentation; public function __construct() { $this->tvUsers = 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 getTvCompany(): ?TvCompany { return $this->tvCompany; } public function setTvCompany(?TvCompany $tvCompany): self { $this->tvCompany = $tvCompany; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } /** * @return Collection|TvUser[] */ public function getTvUsers(): Collection { return $this->tvUsers; } public function addUser(TvUser $tvUser): self { if (!$this->tvUsers->contains($tvUser)) { $this->tvUsers[] = $tvUser; $tvUser->setDepartment($this); } return $this; } public function removeUser(TvUser $tvUser): self { if ($this->tvUsers->removeElement($tvUser)) { // set the owning side to null (unless already changed) if ($tvUser->getDepartment() === $this) { $tvUser->setDepartment(null); } } return $this; } public function getSegmentation(): ?Segmentation { return $this->segmentation; } public function setSegmentation(?Segmentation $segmentation): self { $this->segmentation = $segmentation; return $this; }}