<?php
namespace App\Entity;
use App\Repository\DegreeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
#[ORM\Entity(repositoryClass: DegreeRepository::class)]
class Degree
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
#[Groups(['list'])]
private ?int $id;
#[ORM\ManyToOne(targetEntity: DegreeGroup::class)]
#[Groups(['list'])]
private ?DegreeGroup $degreeGroup;
#[ORM\Column(type: 'string', length: 250)]
#[Groups(['list'])]
private ?string $name;
#[ORM\Column(type: 'text', nullable: true)]
#[Groups(['list'])]
private ?string $description;
#[ORM\Column(type: 'boolean')]
private ?bool $isDeleted;
#[ORM\Column(type: 'boolean')]
private ?bool $isTraining;
#[ORM\OneToMany(mappedBy: 'degree', targetEntity: Admission::class)]
private $admissions;
public function __construct()
{
$this->admissions = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
public function isIsDeleted(): ?bool
{
return $this->isDeleted;
}
public function setIsDeleted(bool $isDeleted): self
{
$this->isDeleted = $isDeleted;
return $this;
}
public function isIsTraining(): ?bool
{
return $this->isTraining;
}
public function setIsTraining(bool $isTraining): self
{
$this->isTraining = $isTraining;
return $this;
}
public function getDegreeGroup(): ?DegreeGroup
{
return $this->degreeGroup;
}
public function setDegreeGroup(?DegreeGroup $degreeGroup): self
{
$this->degreeGroup = $degreeGroup;
return $this;
}
/**
* @return Collection|null
*/
public function getAdmissions(): ?Collection
{
return $this->admissions;
}
public function addAdmission(Admission $admission): self
{
if (!$this->admissions->contains($admission)) {
$this->admissions[] = $admission;
$admission->setDegree($this);
}
return $this;
}
public function removeAdmission(Admission $admission): self
{
if ($this->admissions->removeElement($admission)) {
// set the owning side to null (unless already changed)
if ($admission->getDegree() === $this) {
$admission->setDegree(null);
}
}
return $this;
}
}