File: /var/www/dvpis2026/dvpis.kaunokolegija.lt/src/Entity/Ktv.php
<?php
namespace App\Entity;
use App\Entity\Poll\AnswerField;
use App\Repository\KtvRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
#[ORM\Table(name: 'ktv')]
#[ORM\Entity(repositoryClass: KtvRepository::class)]
class Ktv
{
#[ORM\Column]
#[ORM\Id]
#[ORM\GeneratedValue]
private ?int $id = null;
#[ORM\Column(name: 'short_name', type: 'string', length: 255)]
private string $shortName;
#[ORM\Column(name: 'name', type: 'string', length: 255)]
private string $name;
#[ORM\OneToMany(mappedBy: 'ktv', targetEntity: KtvLecturer::class)]
private Collection $KtvLecturers;
#[ORM\JoinColumn(name: 'answer_field_id', referencedColumnName: 'id', nullable: true)]
#[ORM\ManyToOne(targetEntity: AnswerField::class, inversedBy: 'ktvs')]
private ?AnswerField $answerField;
public function __construct()
{
$this->KtvLecturers = new ArrayCollection();
}
public function __toString()
{
return $this->name;
}
public function getId(): ?int
{
return $this->id;
}
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 setMinmaxHours(string $minmaxHours): static
{
$this->minmaxHours = $minmaxHours;
return $this;
}
public function getMinmaxHours(): string
{
return $this->minmaxHours;
}
/**
* Set type
*
* @param string $type
*
* @return KTV
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* Get type
*
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* @return Collection<int, KtvLecturer>
*/
public function getKtvLecturers(): Collection
{
return $this->KtvLecturers;
}
public function setKtvLecturers($KtvLecturers)
{
$this->KtvLecturers = $KtvLecturers;
return $this;
}
public function getAnswerField(): ?AnswerField
{
return $this->answerField;
}
public function setAnswerField(?AnswerField $answerField): static
{
$this->answerField = $answerField;
return $this;
}
public function addKtvLecturer(KtvLecturer $ktvLecturer): static
{
if (!$this->KtvLecturers->contains($ktvLecturer)) {
$this->KtvLecturers->add($ktvLecturer);
$ktvLecturer->setKtv($this);
}
return $this;
}
public function removeKtvLecturer(KtvLecturer $ktvLecturer): static
{
if ($this->KtvLecturers->removeElement($ktvLecturer)) {
// set the owning side to null (unless already changed)
if ($ktvLecturer->getKtv() === $this) {
$ktvLecturer->setKtv(null);
}
}
return $this;
}
}