HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/dvpis2025/dvpis.kaunokolegija.lt/src/Entity/AcademicGroup.php
<?php

namespace App\Entity;

use App\Repository\AcademicGroupRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

/**
 * AcademicGroup
 */
#[ORM\Table(name: 'academic_group')]
#[ORM\Entity(repositoryClass: AcademicGroupRepository::class)]
class AcademicGroup
{
    #[ORM\Column]
    #[ORM\Id]
    #[ORM\GeneratedValue]
    private ?int $id = null;

    /**
     * @var string
     */
    #[ORM\Column(length: 255, unique: true)]
    private string $name;

    #[ORM\JoinColumn(name: 'studies_form_id', referencedColumnName: 'id', nullable: false)]
    #[ORM\ManyToOne(targetEntity: StudiesForm::class, inversedBy: 'academicGroups')]
    private ?StudiesForm $studiesForm;

    #[ORM\Column(name: 'course', type: 'integer')]
    private int $course;

    #[ORM\Column(name: 'student_count', type: 'integer')]
    private int $studentCount;

    /**
     * @var int
     */
    #[ORM\Column(name: 'student_part_count', type: 'integer', nullable: true)]
    private ?int $studentPartCount = null;

    /**
     * @var int
     */
    #[ORM\Column(name: 'student_listener_count', type: 'integer', nullable: true)]
    private $studentListenerCount;

    #[ORM\JoinColumn(name: 'studies_program_id', referencedColumnName: 'id', nullable: false)]
    #[ORM\ManyToOne(targetEntity: StudiesProgram::class, inversedBy: 'academicGroup')]
    private ?StudiesProgram $studiesProgram;

    #[ORM\OneToMany(mappedBy: 'academicGroup', targetEntity: AcademicGroupPlan::class)]
    private Collection $academicGroupPlans;

    public function __construct()
    {
        $this->academicGroupPlans = new ArrayCollection();
    }

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getStudiesProgram(): ?StudiesProgram
    {
        return $this->studiesProgram;
    }

    public function setStudiesProgram(?StudiesProgram $studiesProgram): static
    {
        $this->studiesProgram = $studiesProgram;

        return $this;
    }

    public function setName(string $name): static
    {
        $this->name = $name;

        return $this;
    }

    public function getName(): ?string
    {
        return $this->name;
    }

    public function setStudiesForm(?StudiesForm $studiesForm): static
    {
        $this->studiesForm = $studiesForm;

        return $this;
    }

    public function getStudiesForm(): ?StudiesForm
    {
        return $this->studiesForm;
    }

    public function setCourse(int $course): static
    {
        $this->course = $course;

        return $this;
    }

    public function getCourse(): ?int
    {
        return $this->course;
    }

    public function setStudentCount(int $studentCount): static
    {
        $this->studentCount = $studentCount;

        return $this;
    }

    public function getStudentCount(): ?int
    {
        return $this->studentCount;
    }

    public function setStudentPartCount(?int $studentPartCount): static
    {
        $this->studentPartCount = $studentPartCount;

        return $this;
    }

    public function getStudentPartCount(): ?int
    {
        return $this->studentPartCount;
    }

    public function setStudentListenerCount(?int $studentListenerCount): static
    {
        $this->studentListenerCount = $studentListenerCount;

        return $this;
    }

    public function getStudentListenerCount(): ?int
    {
        return $this->studentListenerCount;
    }

    public function __toString()
    {
        return $this->name;
    }

    /**
     * @return Collection<int, AcademicGroupPlan>
     */
    public function getAcademicGroupPlans(): Collection
    {
        return $this->academicGroupPlans;
    }

    public function addAcademicGroupPlan(AcademicGroupPlan $academicGroupPlan): static
    {
        if (!$this->academicGroupPlans->contains($academicGroupPlan)) {
            $this->academicGroupPlans->add($academicGroupPlan);
            $academicGroupPlan->setAcademicGroup($this);
        }

        return $this;
    }

    public function removeAcademicGroupPlan(AcademicGroupPlan $academicGroupPlan): static
    {
        if ($this->academicGroupPlans->removeElement($academicGroupPlan)) {
            // set the owning side to null (unless already changed)
            if ($academicGroupPlan->getAcademicGroup() === $this) {
                $academicGroupPlan->setAcademicGroup(null);
            }
        }

        return $this;
    }
}