<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity
* @ORM\Table(name="modalidad")
*/
class Modalidad extends \App\Entity\BaseEntity
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", nullable=true, name="id_externo")
*/
private $idExterno;
/**
* @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2024-01-01 00:00:00"})
* @Gedmo\Timestampable(on="create")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2024-01-01 00:00:00"})
* @Gedmo\Timestampable(on="update")
*/
private $updatedAt;
/**
* @ORM\Column(type="datetime", nullable=true, name="deleted_at")
*/
private $deletedAt;
/**
* @ORM\Column(type="json", nullable=true)
*/
private $nombre;
/**
* @ORM\OneToMany(targetEntity=\App\Entity\SolicitudAccionFormativa::class, mappedBy="modalidad")
*/
private $solicitudAccionFormativas;
/**
* @ORM\OneToMany(targetEntity=\App\Entity\GrupoSesiones::class, mappedBy="modalidad")
*/
private $grupoSesiones;
public function __construct()
{
$this->grupoSesiones = new ArrayCollection();
$this->solicitudAccionFormativas = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setId($id)
{
$this->id = $id;
return $this;
}
public function getIdExterno(): ?string
{
return $this->idExterno;
}
public function setIdExterno(?string $idExterno): static
{
$this->idExterno = $idExterno;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): static
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(\DateTimeInterface $updatedAt): static
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getDeletedAt(): ?\DateTimeInterface
{
return $this->deletedAt;
}
public function setDeletedAt(?\DateTimeInterface $deletedAt): static
{
$this->deletedAt = $deletedAt;
return $this;
}
/**
* @return Collection<int, GrupoSesiones>
*/
public function getGrupoSesiones(): Collection
{
return $this->grupoSesiones;
}
public function addGrupoSesione(GrupoSesiones $grupoSesione): static
{
if (!$this->grupoSesiones->contains($grupoSesione)) {
$this->grupoSesiones->add($grupoSesione);
$grupoSesione->setModalidad($this);
}
return $this;
}
public function removeGrupoSesione(GrupoSesiones $grupoSesione): static
{
if ($this->grupoSesiones->removeElement($grupoSesione)) {
// set the owning side to null (unless already changed)
if ($grupoSesione->getModalidad() === $this) {
$grupoSesione->setModalidad(null);
}
}
return $this;
}
/**
* @return Collection<int, SolicitudAccionFormativa>
*/
public function getSolicitudAccionFormativas(): Collection
{
return $this->solicitudAccionFormativas;
}
public function addSolicitudAccionFormativa(SolicitudAccionFormativa $solicitudAccionFormativa): static
{
if (!$this->solicitudAccionFormativas->contains($solicitudAccionFormativa)) {
$this->solicitudAccionFormativas->add($solicitudAccionFormativa);
$solicitudAccionFormativa->setModalidad($this);
}
return $this;
}
public function removeSolicitudAccionFormativa(SolicitudAccionFormativa $solicitudAccionFormativa): static
{
if ($this->solicitudAccionFormativas->removeElement($solicitudAccionFormativa)) {
// set the owning side to null (unless already changed)
if ($solicitudAccionFormativa->getModalidad() === $this) {
$solicitudAccionFormativa->setModalidad(null);
}
}
return $this;
}
public function getNombre(): ?array
{
return $this->nombre;
}
public function setNombre(?array $nombre): static
{
$this->nombre = $nombre;
return $this;
}
public function __toString(): string
{
if (empty($this->nombre)) return "";
return isset($this->nombre[$_SERVER['LOCALE']]) ? $this->nombre[$_SERVER['LOCALE']] : reset($this->nombre);
}
}