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/StudiesModuleType.php
<?php

namespace App\Entity;

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

/**
 * StudiesModuleType
 */
#[ORM\Table(name: 'studies_module_type')]
#[ORM\Entity(repositoryClass: \App\Repository\StudiesModuleTypeRepository::class)]
class StudiesModuleType
{
    #[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: 'studiesModuleType', targetEntity: StudiesProgramPlan::class)]
    private Collection $studiesProgramPlans;

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

    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 __toString()
    {
        return $this->name;
    }

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

    public function addStudiesProgramPlan(StudiesProgramPlan $studiesProgramPlan): static
    {
        if (!$this->studiesProgramPlans->contains($studiesProgramPlan)) {
            $this->studiesProgramPlans->add($studiesProgramPlan);
            $studiesProgramPlan->setStudiesModuleType($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->getStudiesModuleType() === $this) {
                $studiesProgramPlan->setStudiesModuleType(null);
            }
        }

        return $this;
    }
}