<?php
namespace App\Core\Entity\Institucion;
use App\Core\Entity\Color;
use App\Core\Repository\Institucion\InstitucionRepository;
use App\Core\Entity\Institucion\DirectorInstitucion;
use App\Core\Entity\Institucion\Campus;
use App\Entity\InvitacionInstitucion;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Entity(repositoryClass=InstitucionRepository::class)
* @Vich\Uploadable()
*/
class Institucion
{
const JSON_FIELDS = ['id', 'nombre', 'sobreNosotros', 'paginaWeb', 'directoresInstitucion' => ['id', 'director' => ['id']], 'estado', 'imgPortadaName', 'imgInstitucionName', 'campuses' => ['id', 'nombre', 'descripcion', 'programas' => ['id', 'nombre', 'ciclos']]];
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=100)
*/
private $nombre;
/**
* @ORM\Column(type="text")
*/
private $sobreNosotros;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $paginaWeb;
/**
* @ORM\OneToMany(targetEntity=DirectorInstitucion::class, mappedBy="institucion")
*/
private $directoresInstitucion;
/**
* @ORM\Column(type="integer")
*/
private $estado;
/**
* NOTE: This is not a mapped field of entity metadata, just a simple property.
*
* @Vich\UploadableField(mapping="portada_de_institucion", fileNameProperty="imgPortadaName", size="imgPortadaSize")
*
* @var File|null
*/
private $imgPortada;
/**
* @ORM\Column(type="string", length=200, nullable=true)
*
* @var string|null
*/
private $imgPortadaName;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @var int|null
*/
private $imgPortadaSize;
/**
* NOTE: This is not a mapped field of entity metadata, just a simple property.
*
* @Vich\UploadableField(mapping="perfil_de_institucion", fileNameProperty="imgInstitucionName", size="imgInstitucionSize")
*
* @var File|null
*/
private $imgInstitucion;
/**
* @ORM\Column(type="string", length=200, nullable=true)
*
* @var string|null
*/
private $imgInstitucionName;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @var int|null
*/
private $imgInstitucionSize;
/**
* @ORM\ManyToOne(targetEntity="App\Core\Entity\Color")
* @ORM\JoinColumn(nullable=false)
*/
private $color;
/**
* @ORM\OneToMany(targetEntity=Campus::class, mappedBy="institucion")
*/
private $campuses;
/**
* @ORM\OneToMany(targetEntity=InvitacionInstitucion::class, mappedBy="institucion")
*/
private $invitacionInstitucions;
public function __construct()
{
$this->directoresInstitucion = new ArrayCollection();
$this->campuses = new ArrayCollection();
$this->invitacionInstitucions = 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 getSobreNosotros(): ?string
{
return $this->sobreNosotros;
}
public function setSobreNosotros(string $sobreNosotros): self
{
$this->sobreNosotros = $sobreNosotros;
return $this;
}
public function getPaginaWeb(): ?string
{
return $this->paginaWeb;
}
public function setPaginaWeb(?string $paginaWeb): self
{
$this->paginaWeb = $paginaWeb;
return $this;
}
/**
* @return Collection|DirectorInstitucion[]
*/
public function getDirectoresInstitucion(): Collection
{
return $this->directoresInstitucion;
}
public function addDirectoresInstitucion(DirectorInstitucion $directoresInstitucion): self
{
if (!$this->directoresInstitucion->contains($directoresInstitucion)) {
$this->directoresInstitucion[] = $directoresInstitucion;
$directoresInstitucion->setInstitucion($this);
}
return $this;
}
public function removeDirectoresInstitucion(DirectorInstitucion $directoresInstitucion): self
{
if ($this->directoresInstitucion->removeElement($directoresInstitucion)) {
// set the owning side to null (unless already changed)
if ($directoresInstitucion->getInstitucion() === $this) {
$directoresInstitucion->setInstitucion(null);
}
}
return $this;
}
public function getEstado(): ?int
{
return $this->estado;
}
public function setEstado(int $estado): self
{
$this->estado = $estado;
return $this;
}
/**
* If manually uploading a file (i.e. not using Symfony Form) ensure an instance
* of 'UploadedFile' is injected into this setter to trigger the update. If this
* bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
* must be able to accept an instance of 'File' as the bundle will inject one here
* during Doctrine hydration.
*
* @param File|UploadedFile|null $uploadedFile
*/
public function setImgPortada(?File $uploadedFile = null): void
{
$this->imgPortada = $uploadedFile;
if (null !== $uploadedFile) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->setImgPortadaSize($uploadedFile->getSize());
}
}
public function getImgPortada(): ?File
{
return $this->imgPortada;
}
public function setImgPortadaName(?string $imgPortadaName): void
{
$this->imgPortadaName = $imgPortadaName;
}
public function getImgPortadaName(): ?string
{
return $this->imgPortadaName;
}
public function setImgPortadaSize(?int $imgPortadaSize): void
{
$this->imgPortadaSize = $imgPortadaSize;
}
public function getImgPortadaSize(): ?int
{
return $this->imgPortadaSize;
}
/**
* If manually uploading a file (i.e. not using Symfony Form) ensure an instance
* of 'UploadedFile' is injected into this setter to trigger the update. If this
* bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
* must be able to accept an instance of 'File' as the bundle will inject one here
* during Doctrine hydration.
*
* @param File|UploadedFile|null $uploadedFile
*/
public function setImgInstitucion(?File $uploadedFile = null): void
{
$this->imgInstitucion = $uploadedFile;
if (null !== $uploadedFile) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->setImgInstitucionSize($uploadedFile->getSize());
}
}
public function getImgInstitucion(): ?File
{
return $this->imgInstitucion;
}
public function setImgInstitucionName(?string $imgInstitucionName): void
{
$this->imgInstitucionName = $imgInstitucionName;
}
public function getImgInstitucionName(): ?string
{
return $this->imgInstitucionName;
}
public function setImgInstitucionSize(?int $imgInstitucionSize): void
{
$this->imgInstitucionSize = $imgInstitucionSize;
}
public function getImgInstitucionSize(): ?int
{
return $this->imgInstitucionSize;
}
public function getColor(): ?Color
{
return $this->color;
}
public function setColor(Color $color): self
{
$this->color = $color;
return $this;
}
/**
* @return Collection|Campus[]
*/
public function getCampuses(): Collection
{
return $this->campuses;
}
public function addCampus(Campus $campus): self
{
if (!$this->campuses->contains($campus)) {
$this->campuses[] = $campus;
$campus->setInstitucion($this);
}
return $this;
}
public function removeCampus(Campus $campus): self
{
if ($this->campuses->removeElement($campus)) {
// set the owning side to null (unless already changed)
if ($campus->getInstitucion() === $this) {
$campus->setInstitucion(null);
}
}
return $this;
}
/**
* @return Collection<int, InvitacionInstitucion>
*/
public function getInvitacionInstitucions(): Collection
{
return $this->invitacionInstitucions;
}
public function addInvitacionInstitucion(InvitacionInstitucion $invitacionInstitucion): self
{
if (!$this->invitacionInstitucions->contains($invitacionInstitucion)) {
$this->invitacionInstitucions[] = $invitacionInstitucion;
$invitacionInstitucion->setInstitucion($this);
}
return $this;
}
public function removeInvitacionInstitucion(InvitacionInstitucion $invitacionInstitucion): self
{
if ($this->invitacionInstitucions->removeElement($invitacionInstitucion)) {
// set the owning side to null (unless already changed)
if ($invitacionInstitucion->getInstitucion() === $this) {
$invitacionInstitucion->setInstitucion(null);
}
}
return $this;
}
}