<?php
namespace App\Core\Entity\Institucion;
use App\Core\Entity\Curso;
use App\Core\Repository\Institucion\NivelRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=NivelRepository::class)
*/
class Nivel
{
const JSON_FIELDS = ['id', 'nombre', 'siguienteNivel' => ['id', 'nombre'], 'programa' => ['id', 'nombre', 'secciones'], 'nivelClon' => ['id', 'nombre'], 'correlativo', 'materias' => ['id', 'nombre', 'descripcion'], 'secciones' =>['id', 'nombre', 'correlativo']];
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=100)
*/
private $nombre;
/**
* @ORM\ManyToOne(targetEntity=Nivel::class)
*/
private $siguienteNivel;
/**
* @ORM\ManyToOne(targetEntity=Programa::class, inversedBy="niveles")
* @ORM\JoinColumn(nullable=false)
*/
private $programa;
/**
* @ORM\ManyToOne(targetEntity=Nivel::class)
*/
private $nivelClon;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $correlativo;
/**
* @ORM\OneToMany(targetEntity=Seccion::class, mappedBy="nivel")
*/
private $secciones;
/**
* @ORM\OneToMany(targetEntity=Curso::class, mappedBy="nivel")
*/
private $materias;
public function __construct()
{
$this->secciones = new ArrayCollection();
$this->materias = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNombre(): ?string
{
return $this->nombre;
}
public function setNombre(string $nombre): self
{
$this->nombre = $nombre;
return $this;
}
public function getSiguienteNivel(): ?self
{
return $this->siguienteNivel;
}
public function setSiguienteNivel(?self $siguienteNivel): self
{
$this->siguienteNivel = $siguienteNivel;
return $this;
}
public function getPrograma(): ?Programa
{
return $this->programa;
}
public function setPrograma(?Programa $programa): self
{
$this->programa = $programa;
return $this;
}
public function getNivelClon(): ?self
{
return $this->nivelClon;
}
public function setNivelClon(?self $nivelClon): self
{
$this->nivelClon = $nivelClon;
return $this;
}
public function getCorrelativo(): ?string
{
return $this->correlativo;
}
public function setCorrelativo(?string $correlativo): self
{
$this->correlativo = $correlativo;
return $this;
}
/**
* @return Collection|Seccion[]
*/
public function getSecciones(): Collection
{
return $this->secciones;
}
public function addSeccion(Seccion $seccion): self
{
if (!$this->secciones->contains($seccion)) {
$this->secciones[] = $seccion;
$seccion->setNivel($this);
}
return $this;
}
public function removeSeccion(Seccion $seccion): self
{
if ($this->secciones->removeElement($seccion)) {
// set the owning side to null (unless already changed)
if ($seccion->getNivel() === $this) {
$seccion->setNivel(null);
}
}
return $this;
}
/**
* @return Collection|Curso[]
*/
public function getMaterias(): Collection
{
return $this->materias;
}
public function addMateria(Curso $curso): self
{
if (!$this->materias->contains($curso)) {
$this->materias[] = $curso;
$curso->setNivel($this);
}
return $this;
}
public function removeMateria(Curso $curso): self
{
if ($this->materias->removeElement($curso)) {
// set the owning side to null (unless already changed)
if ($curso->getNivel() === $this) {
$curso->setNivel(null);
}
}
return $this;
}
}