File: /var/www/dvpis2026/dvpis.kaunokolegija.lt/src/Entity/Tmmv.php
<?php
namespace App\Entity;
use App\Entity\Poll\AnswerField;
use App\Repository\TmmvRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
#[ORM\Table(name: 'tmmv')]
#[ORM\Entity(repositoryClass: TmmvRepository::class)]
class Tmmv
{
#[ORM\Column]
#[ORM\Id]
#[ORM\GeneratedValue]
private ?int $id = null;
#[ORM\Column(name: 'short_name', type: 'string', length: 255, unique: true)]
private string $shortName;
#[ORM\Column(name: 'name', type: 'string', length: 255)]
private string $name;
/**
* @var int
*/
#[ORM\Column(name: 'minHours', type: 'string', length: 255)]
private $minMaxHours;
#[ORM\OneToMany(mappedBy: 'tmmv', targetEntity: TmmvLecturer::class)]
private Collection $TmmvLecturers;
#[ORM\JoinColumn(name: 'answer_field_id', referencedColumnName: 'id', nullable: true)]
#[ORM\ManyToOne(targetEntity: AnswerField::class, inversedBy: 'tmmvs')]
private ?AnswerField $answerField;
public function __construct()
{
$this->TmmvLecturers = new ArrayCollection();
}
public function __toString()
{
return $this->name . " (" . $this->minMaxHours . ")";
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function getMinMaxHours(): ?string
{
return $this->minMaxHours;
}
public function setId($id)
{
$this->id = $id;
return $this;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function setMinMaxHours(string $minMaxHours): static
{
$this->minMaxHours = $minMaxHours;
return $this;
}
public function getShortName(): ?string
{
return $this->shortName;
}
public function setShortName(string $shortName): static
{
$this->shortName = $shortName;
return $this;
}
/**
* @return Collection<int, TmmvLecturer>
*/
public function getTmmvLecturers(): Collection
{
return $this->TmmvLecturers;
}
public function setTmmvLecturers($TmmvLecturers)
{
$this->TmmvLecturers = $TmmvLecturers;
return $this;
}
public function getAnswerField(): ?AnswerField
{
return $this->answerField;
}
public function setAnswerField(?AnswerField $answerField): static
{
$this->answerField = $answerField;
return $this;
}
public function addTmmvLecturer(TmmvLecturer $tmmvLecturer): static
{
if (!$this->TmmvLecturers->contains($tmmvLecturer)) {
$this->TmmvLecturers->add($tmmvLecturer);
$tmmvLecturer->setTmmv($this);
}
return $this;
}
public function removeTmmvLecturer(TmmvLecturer $tmmvLecturer): static
{
if ($this->TmmvLecturers->removeElement($tmmvLecturer)) {
// set the owning side to null (unless already changed)
if ($tmmvLecturer->getTmmv() === $this) {
$tmmvLecturer->setTmmv(null);
}
}
return $this;
}
}