<?php
namespace App\Core\Entity\Institucion;
use App\Core\Entity\Color;
use App\Core\Entity\Direccion;
use App\Core\Entity\Institucion\Institucion;
use App\Core\Repository\Institucion\CampusRepository;
use App\Core\Entity\Institucion\Programa;
use App\Entity\CampusMaestro;
use App\Entity\Ciclo;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CampusRepository::class)
*/
class Campus
{
const JSON_FIELDS = ['id', 'nombre', 'descripcion', 'institucion' => ['id', 'nombre'], 'campusClon' => ['id', 'nombre'], 'color' => ['id', 'nombre'], 'programas' => Programa::JSON_FIELDS];
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=100)
*/
private $nombre;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $descripcion;
/**
* @ORM\ManyToOne(targetEntity=Color::class)
* @ORM\JoinColumn(nullable=false)
*/
private $color;
/**
* @ORM\ManyToOne(targetEntity=Direccion::class)
* @ORM\JoinColumn(nullable=true)
*/
private $direccion;
/**
* @ORM\ManyToOne(targetEntity=Institucion::class, inversedBy="campuses")
* @ORM\JoinColumn(nullable=false)
*/
private $institucion;
/**
* @ORM\ManyToOne(targetEntity=Campus::class)
* @ORM\JoinColumn(nullable=true)
*/
private $campusClon;
/**
* @ORM\OneToMany(targetEntity=Programa::class, mappedBy="campus")
*/
private $programas;
/**
* @ORM\Column(name="`virtual`", type="boolean", nullable=false)
*/
private $virtual;
/**
* @ORM\OneToMany(targetEntity=CampusMaestro::class, mappedBy="Campus")
*/
private $estado;
public function __construct()
{
$this->programas = new ArrayCollection();
$this->estado = 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 getDescripcion(): ?string
{
return $this->descripcion;
}
public function setDescripcion(?string $descripcion): self
{
$this->descripcion = $descripcion;
return $this;
}
public function getColor(): ?Color
{
return $this->color;
}
public function setColor(?Color $color): self
{
$this->color = $color;
return $this;
}
public function getDireccion(): ?Direccion
{
return $this->direccion;
}
public function setDireccion(?Direccion $direccion): self
{
$this->direccion = $direccion;
return $this;
}
public function getInstitucion(): ?Institucion
{
return $this->institucion;
}
public function setInstitucion(?Institucion $institucion): self
{
$this->institucion = $institucion;
return $this;
}
public function getCampusClon(): ?Campus
{
return $this->campusClon;
}
public function setCampusClon(?Campus $campusClon): self
{
$this->campusClon = $campusClon;
return $this;
}
/**
* @return Collection|Programa[]
*/
public function getProgramas(): Collection
{
return $this->programas;
}
public function addPrograma(Programa $programa): self
{
if (!$this->programas->contains($programa)) {
$this->programas[] = $programa;
$programa->setCampus($this);
}
return $this;
}
public function removePrograma(Programa $programa): self
{
if ($this->programas->removeElement($programa)) {
// set the owning side to null (unless already changed)
if ($programa->getCampus() === $this) {
$programa->setCampus(null);
}
}
return $this;
}
public function getVirtual(): ?bool
{
return $this->virtual;
}
public function setVirtual(?bool $virtual): self
{
$this->virtual = $virtual;
return $this;
}
/**
* @return Collection<int, CampusMaestro>
*/
public function getEstado(): Collection
{
return $this->estado;
}
public function addEstado(CampusMaestro $estado): self
{
if (!$this->estado->contains($estado)) {
$this->estado[] = $estado;
$estado->setCampus($this);
}
return $this;
}
public function removeEstado(CampusMaestro $estado): self
{
if ($this->estado->removeElement($estado)) {
// set the owning side to null (unless already changed)
if ($estado->getCampus() === $this) {
$estado->setCampus(null);
}
}
return $this;
}
}