File: /var/www/dvpis2025/dvpis.kaunokolegija.lt/src/Entity/Department.php
<?php
namespace App\Entity;
use App\Repository\DepartmentRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* Department
*/
#[ORM\Table(name: 'department')]
#[ORM\Entity(repositoryClass: DepartmentRepository::class)]
class Department
{
#[ORM\Column]
#[ORM\Id]
#[ORM\GeneratedValue]
private ?int $id = null;
/**
* @var string
*/
#[ORM\Column(name: 'short_name', type: 'string', length: 255, unique: true)]
private $shortName;
/**
* @var string
*/
#[ORM\Column(name: 'name', type: 'string', length: 255)]
private $name;
/**
* @var string
*/
#[ORM\Column(name: 'department_head_name', type: 'string', length: 255)]
private $departmentHeadName;
/**
* @var float
*/
#[ORM\Column(name: 'department_head_post_part', type: 'float')]
private $departmentHeadPostPart;
#[ORM\JoinColumn(name: 'academic_unit_id', referencedColumnName: 'id', nullable: false)]
#[ORM\ManyToOne(targetEntity: AcademicUnit::class, inversedBy: 'departments')]
private ?AcademicUnit $academicUnit;
#[ORM\OneToMany(mappedBy: 'department', targetEntity: StudiesProgram::class)]
private Collection $studiesPrograms;
#[ORM\OneToMany(mappedBy: 'department', targetEntity: Lecturer::class)]
private Collection $lecturers;
#[ORM\OneToMany(mappedBy: 'lecturerDepartment', targetEntity: LecturerPlan::class)]
private Collection $lecturerPlans;
#[ORM\OneToMany(mappedBy: 'lecturerDepartment', targetEntity: LecturerPlanHistory::class)]
private Collection $lecturerPlanHistorys;
#[ORM\OneToMany(mappedBy: 'lecturerDepartment', targetEntity: FinalProject::class)]
private Collection $finalProjects;
#[ORM\OneToMany(mappedBy: 'lecturerDepartment', targetEntity: FinalProjectHistory::class)]
private Collection $finalProjectsHistory;
#[ORM\OneToMany(mappedBy: 'lecturerDepartment', targetEntity: FinalEgzam::class)]
private Collection $finalEgzams;
#[ORM\OneToMany(mappedBy: 'lecturerDepartment', targetEntity: FinalEgzamHistory::class)]
private Collection $finalEgzamsHistory;
#[ORM\OneToMany(mappedBy: 'department', targetEntity: User::class)]
private Collection $users;
public function __construct()
{
$this->users = new ArrayCollection();
$this->finalEgzams = new ArrayCollection();
$this->finalProjects = new ArrayCollection();
$this->finalEgzamsHistory = new ArrayCollection();
$this->finalProjectsHistory = new ArrayCollection();
$this->studiesPrograms = new ArrayCollection();
$this->lecturers = new ArrayCollection();
$this->lecturerPlans = new ArrayCollection();
$this->lecturerPlanHistorys = new ArrayCollection();
}
/**
* @return Collection<int, FinalEgzam>
*/
public function getFinalEgzams(): Collection
{
return $this->finalEgzams;
}
public function setFinalEgzams($finalEgzams)
{
$this->finalEgzams = $finalEgzams;
return $this;
}
/**
* @return Collection<int, FinalEgzamHistory>
*/
public function getFinalEgzamsHistory(): Collection
{
return $this->finalEgzamsHistory;
}
public function setFinalEgzamsHistory($finalEgzamsHistory)
{
$this->finalEgzamsHistory = $finalEgzamsHistory;
return $this;
}
public function getDepartmentHeadName(): ?string
{
return $this->departmentHeadName;
}
public function setDepartmentHeadName(string $departmentHeadName): static
{
$this->departmentHeadName = $departmentHeadName;
return $this;
}
/**
* @return Collection<int, StudiesProgram>
*/
public function getStudiesPrograms(): Collection
{
return $this->studiesPrograms;
}
public function setStudiesPrograms($studiesPrograms)
{
$this->studiesPrograms = $studiesPrograms;
return $this;
}
public function __toString()
{
return $this->name . "(" . $this->shortName . ")";
}
public function getId(): ?int
{
return $this->id;
}
public function getAcademicUnit(): ?AcademicUnit
{
return $this->academicUnit;
}
public function setAcademicUnit(?AcademicUnit $academicUnit): static
{
$this->academicUnit = $academicUnit;
return $this;
}
public function setShortName(string $shortName): static
{
$this->shortName = $shortName;
return $this;
}
public function getShortName(): ?string
{
return $this->shortName;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setDepartmentHeadPostPart(float $departmentHeadPostPart): static
{
$this->departmentHeadPostPart = $departmentHeadPostPart;
return $this;
}
public function getDepartmentHeadPostPart(): ?float
{
return $this->departmentHeadPostPart;
}
/**
* @return Collection<int, LecturerPlan>
*/
public function getLecturerPlans(): Collection
{
return $this->lecturerPlans;
}
public function setLecturerPlans($lecturerPlans)
{
$this->lecturerPlans = $lecturerPlans;
return $this;
}
/**
* @return Collection<int, LecturerPlanHistory>
*/
public function getLecturerPlanHistorys(): Collection
{
return $this->lecturerPlanHistorys;
}
public function setLecturerPlanHistorys($lecturerPlanHistorys)
{
$this->lecturerPlanHistorys = $lecturerPlanHistorys;
return $this;
}
/**
* @return Collection<int, Lecturer>
*/
public function getLecturers(): Collection
{
return $this->lecturers;
}
public function setLecturers($lecturers)
{
$this->lecturers = $lecturers;
return $this;
}
/**
* @return Collection<int, FinalProject>
*/
public function getFinalProjects(): Collection
{
return $this->finalProjects;
}
public function setFinalProjects($finalProjects)
{
$this->finalProjects = $finalProjects;
return $this;
}
/**
* @return Collection<int, FinalProjectHistory>
*/
public function getFinalProjectsHistory(): Collection
{
return $this->finalProjectsHistory;
}
public function setFinalProjectsHistory($finalProjectsHistory)
{
$this->finalProjectsHistory = $finalProjectsHistory;
return $this;
}
public function addStudiesProgram(StudiesProgram $studiesProgram): static
{
if (!$this->studiesPrograms->contains($studiesProgram)) {
$this->studiesPrograms->add($studiesProgram);
$studiesProgram->setDepartment($this);
}
return $this;
}
public function removeStudiesProgram(StudiesProgram $studiesProgram): static
{
if ($this->studiesPrograms->removeElement($studiesProgram)) {
// set the owning side to null (unless already changed)
if ($studiesProgram->getDepartment() === $this) {
$studiesProgram->setDepartment(null);
}
}
return $this;
}
public function addLecturer(Lecturer $lecturer): static
{
if (!$this->lecturers->contains($lecturer)) {
$this->lecturers->add($lecturer);
$lecturer->setDepartment($this);
}
return $this;
}
public function removeLecturer(Lecturer $lecturer): static
{
if ($this->lecturers->removeElement($lecturer)) {
// set the owning side to null (unless already changed)
if ($lecturer->getDepartment() === $this) {
$lecturer->setDepartment(null);
}
}
return $this;
}
public function addLecturerPlan(LecturerPlan $lecturerPlan): static
{
if (!$this->lecturerPlans->contains($lecturerPlan)) {
$this->lecturerPlans->add($lecturerPlan);
$lecturerPlan->setLecturerDepartment($this);
}
return $this;
}
public function removeLecturerPlan(LecturerPlan $lecturerPlan): static
{
if ($this->lecturerPlans->removeElement($lecturerPlan)) {
// set the owning side to null (unless already changed)
if ($lecturerPlan->getLecturerDepartment() === $this) {
$lecturerPlan->setLecturerDepartment(null);
}
}
return $this;
}
public function addLecturerPlanHistory(LecturerPlanHistory $lecturerPlanHistory): static
{
if (!$this->lecturerPlanHistorys->contains($lecturerPlanHistory)) {
$this->lecturerPlanHistorys->add($lecturerPlanHistory);
$lecturerPlanHistory->setLecturerDepartment($this);
}
return $this;
}
public function removeLecturerPlanHistory(LecturerPlanHistory $lecturerPlanHistory): static
{
if ($this->lecturerPlanHistorys->removeElement($lecturerPlanHistory)) {
// set the owning side to null (unless already changed)
if ($lecturerPlanHistory->getLecturerDepartment() === $this) {
$lecturerPlanHistory->setLecturerDepartment(null);
}
}
return $this;
}
public function addFinalProject(FinalProject $finalProject): static
{
if (!$this->finalProjects->contains($finalProject)) {
$this->finalProjects->add($finalProject);
$finalProject->setLecturerDepartment($this);
}
return $this;
}
public function removeFinalProject(FinalProject $finalProject): static
{
if ($this->finalProjects->removeElement($finalProject)) {
// set the owning side to null (unless already changed)
if ($finalProject->getLecturerDepartment() === $this) {
$finalProject->setLecturerDepartment(null);
}
}
return $this;
}
public function addFinalProjectsHistory(FinalProjectHistory $finalProjectsHistory): static
{
if (!$this->finalProjectsHistory->contains($finalProjectsHistory)) {
$this->finalProjectsHistory->add($finalProjectsHistory);
$finalProjectsHistory->setLecturerDepartment($this);
}
return $this;
}
public function removeFinalProjectsHistory(FinalProjectHistory $finalProjectsHistory): static
{
if ($this->finalProjectsHistory->removeElement($finalProjectsHistory)) {
// set the owning side to null (unless already changed)
if ($finalProjectsHistory->getLecturerDepartment() === $this) {
$finalProjectsHistory->setLecturerDepartment(null);
}
}
return $this;
}
public function addFinalEgzam(FinalEgzam $finalEgzam): static
{
if (!$this->finalEgzams->contains($finalEgzam)) {
$this->finalEgzams->add($finalEgzam);
$finalEgzam->setLecturerDepartment($this);
}
return $this;
}
public function removeFinalEgzam(FinalEgzam $finalEgzam): static
{
if ($this->finalEgzams->removeElement($finalEgzam)) {
// set the owning side to null (unless already changed)
if ($finalEgzam->getLecturerDepartment() === $this) {
$finalEgzam->setLecturerDepartment(null);
}
}
return $this;
}
public function addFinalEgzamsHistory(FinalEgzamHistory $finalEgzamsHistory): static
{
if (!$this->finalEgzamsHistory->contains($finalEgzamsHistory)) {
$this->finalEgzamsHistory->add($finalEgzamsHistory);
$finalEgzamsHistory->setLecturerDepartment($this);
}
return $this;
}
public function removeFinalEgzamsHistory(FinalEgzamHistory $finalEgzamsHistory): static
{
if ($this->finalEgzamsHistory->removeElement($finalEgzamsHistory)) {
// set the owning side to null (unless already changed)
if ($finalEgzamsHistory->getLecturerDepartment() === $this) {
$finalEgzamsHistory->setLecturerDepartment(null);
}
}
return $this;
}
/**
* @return Collection<int, User>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): static
{
if (!$this->users->contains($user)) {
$this->users->add($user);
$user->setDepartment($this);
}
return $this;
}
public function removeUser(User $user): static
{
if ($this->users->removeElement($user)) {
// set the owning side to null (unless already changed)
if ($user->getDepartment() === $this) {
$user->setDepartment(null);
}
}
return $this;
}
}