File: /var/www/dvpis2025/dvpis.kaunokolegija.lt/src/Entity/AcademicGroupPlan.php
<?php
namespace App\Entity;
use App\Repository\AcademicGroupPlanRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* AcademicGroupPlan
*/
#[ORM\Table(name: 'academic_group_plan')]
#[ORM\Entity(repositoryClass: AcademicGroupPlanRepository::class)]
class AcademicGroupPlan
{
#[ORM\Column]
#[ORM\Id]
#[ORM\GeneratedValue]
private ?int $id = null;
#[ORM\JoinColumn(name: 'academic_group_id', referencedColumnName: 'id', nullable: false)]
#[ORM\ManyToOne(targetEntity: AcademicGroup::class, inversedBy: 'academicGroupPlans')]
private ?AcademicGroup $academicGroup;
#[ORM\JoinColumn(name: 'studies_program_plan_id', referencedColumnName: 'id', nullable: false)]
#[ORM\ManyToOne(targetEntity: StudiesProgramPlan::class, inversedBy: 'academicGroupPlans')]
private ?StudiesProgramPlan $studiesProgramPlan;
#[ORM\JoinTable(name: 'academic_group_plan_lecturer_plan')]
#[ORM\ManyToMany(targetEntity: LecturerPlan::class, inversedBy: 'academicGroupPlans', cascade: ['persist'])]
private Collection $lecturerPlans;
#[ORM\JoinTable(name: 'academic_group_plan_lecturer_plan_history')]
#[ORM\ManyToMany(targetEntity: LecturerPlanHistory::class, inversedBy: 'academicGroupPlans', cascade: ['persist'])]
private Collection $lecturerPlanHistorys;
public function __construct()
{
$this->lecturerPlans = new ArrayCollection();
$this->lecturerPlanHistorys = new ArrayCollection();
}
public function addLecturerPlan(LecturerPlan $lecturerPlan): static
{
if (!$this->lecturerPlans->contains($lecturerPlan)) {
$this->lecturerPlans->add($lecturerPlan);
}
return $this;
}
public function removeLecturerPlan(LecturerPlan $lecturerPlan): static
{
$this->lecturerPlans->removeElement($lecturerPlan);
return $this;
}
public function addLecturerPlanHistory(LecturerPlanHistory $lecturerPlanHistory): static
{
if (!$this->lecturerPlanHistorys->contains($lecturerPlanHistory)) {
$this->lecturerPlanHistorys->add($lecturerPlanHistory);
}
return $this;
}
public function removeLecturerPlanHistory(LecturerPlanHistory $lecturerPlanHistory): static
{
$this->lecturerPlanHistorys->removeElement($lecturerPlanHistory);
return $this;
}
public function __toString()
{
return $this->getAcademicGroup() . " " . $this->getStudiesProgramPlan();
}
public function getId(): ?int
{
return $this->id;
}
public function getAcademicGroup(): ?AcademicGroup
{
return $this->academicGroup;
}
public function getStudiesProgramPlan(): ?StudiesProgramPlan
{
return $this->studiesProgramPlan;
}
/**
* @return Collection<int, LecturerPlan>
*/
public function getLecturerPlans(): Collection
{
return $this->lecturerPlans;
}
/**
* @return Collection<int, LecturerPlanHistory>
*/
public function getLecturerPlanHistorys(): Collection
{
return $this->lecturerPlanHistorys;
}
public function setId($id)
{
$this->id = $id;
return $this;
}
public function setAcademicGroup(?AcademicGroup $academicGroup): static
{
$this->academicGroup = $academicGroup;
return $this;
}
public function setStudiesProgramPlan(?StudiesProgramPlan $studiesProgramPlan): static
{
$this->studiesProgramPlan = $studiesProgramPlan;
return $this;
}
public function setLecturerPlans($lecturerPlans)
{
$this->lecturerPlans = $lecturerPlans;
return $this;
}
public function setLecturerPlanHistorys($lecturerPlanHistorys)
{
$this->lecturerPlanHistorys = $lecturerPlanHistorys;
return $this;
}
}