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/dvpis2026/dvpis.kaunokolegija.lt/src/Entity/TeachingLanguage.php
<?php

namespace App\Entity;

use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;

/**
 * TeachingLanguage
 */
#[ORM\Table(name: 'teaching_language')]
#[ORM\Entity(repositoryClass: \App\Repository\TeachingLanguageRepository::class)]
class TeachingLanguage
{
    #[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;

    #[ORM\OneToMany(mappedBy: 'teachingLanguage', targetEntity: LecturerTeachingLanguage::class)]
    private Collection $lecturerTeachingLanguages;

    #[ORM\OneToMany(mappedBy: 'teachingLanguage', targetEntity: StudiesProgramPlan::class)]
    private Collection $studiesProgramPlans;

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

    /**
     * @return Collection<int, LecturerTeachingLanguage>
     */
    public function getLecturerTeachingLanguages(): Collection
    {
        return $this->lecturerTeachingLanguages;
    }

    public function setLecturerTeachingLanguages($lecturerTeachingLanguages)
    {
        $this->lecturerTeachingLanguages = $lecturerTeachingLanguages;
        return $this;
    }

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

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

        return $this;
    }

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

    public function getShortName(): ?string
    {
        return $this->shortName;
    }

    /**
     * @return Collection<int, StudiesProgramPlan>
     */
    public function getStudiesProgramPlans(): Collection
    {
        return $this->studiesProgramPlans;
    }

    public function setShortName(string $shortName): static
    {
        $this->shortName = $shortName;

        return $this;
    }

    public function setStudiesProgramPlans($studiesProgramPlans)
    {
        $this->studiesProgramPlans = $studiesProgramPlans;
        return $this;
    }

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

    public function addLecturerTeachingLanguage(LecturerTeachingLanguage $lecturerTeachingLanguage): static
    {
        if (!$this->lecturerTeachingLanguages->contains($lecturerTeachingLanguage)) {
            $this->lecturerTeachingLanguages->add($lecturerTeachingLanguage);
            $lecturerTeachingLanguage->setTeachingLanguage($this);
        }

        return $this;
    }

    public function removeLecturerTeachingLanguage(LecturerTeachingLanguage $lecturerTeachingLanguage): static
    {
        if ($this->lecturerTeachingLanguages->removeElement($lecturerTeachingLanguage)) {
            // set the owning side to null (unless already changed)
            if ($lecturerTeachingLanguage->getTeachingLanguage() === $this) {
                $lecturerTeachingLanguage->setTeachingLanguage(null);
            }
        }

        return $this;
    }

    public function addStudiesProgramPlan(StudiesProgramPlan $studiesProgramPlan): static
    {
        if (!$this->studiesProgramPlans->contains($studiesProgramPlan)) {
            $this->studiesProgramPlans->add($studiesProgramPlan);
            $studiesProgramPlan->setTeachingLanguage($this);
        }

        return $this;
    }

    public function removeStudiesProgramPlan(StudiesProgramPlan $studiesProgramPlan): static
    {
        if ($this->studiesProgramPlans->removeElement($studiesProgramPlan)) {
            // set the owning side to null (unless already changed)
            if ($studiesProgramPlan->getTeachingLanguage() === $this) {
                $studiesProgramPlan->setTeachingLanguage(null);
            }
        }

        return $this;
    }
}