<?php
namespace App\Entity;
use App\Repository\EspecialidadRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=EspecialidadRepository::class)
*/
class Especialidad
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $nombre;
/**
* @ORM\Column(type="boolean")
*/
private $estado;
/**
* @ORM\Column(type="string", length=50)
*/
private $ip_crea;
/**
* @ORM\Column(type="string", length=50)
*/
private $ip_modifica;
/**
* @ORM\Column(type="integer")
*/
private $user_crea;
/**
* @ORM\Column(type="integer")
*/
private $user_modifica;
/**
* @ORM\Column(type="datetime")
*/
private $created_at;
/**
* @ORM\Column(type="datetime")
*/
private $updated_at;
/**
* @ORM\OneToMany(targetEntity=Agenda::class, mappedBy="especialidad")
*/
private $agendas;
/**
* @ORM\OneToMany(targetEntity=LogAgenda::class, mappedBy="especialidad")
*/
private $logAgendas;
/**
* @ORM\OneToMany(targetEntity=User::class, mappedBy="especialidad")
*/
private $users;
/**
* @ORM\ManyToOne(targetEntity=Dependencia::class)
*/
private $dependencia;
public function __construct()
{
$this->agendas = new ArrayCollection();
$this->logAgendas = new ArrayCollection();
$this->users = 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 getEstado(): ?bool
{
return $this->estado;
}
public function setEstado(bool $estado): self
{
$this->estado = $estado;
return $this;
}
public function getIpCrea(): ?string
{
return $this->ip_crea;
}
public function setIpCrea(string $ip_crea): self
{
$this->ip_crea = $ip_crea;
return $this;
}
public function getIpModifica(): ?string
{
return $this->ip_modifica;
}
public function setIpModifica(string $ip_modifica): self
{
$this->ip_modifica = $ip_modifica;
return $this;
}
public function getUserCrea(): ?int
{
return $this->user_crea;
}
public function setUserCrea(int $user_crea): self
{
$this->user_crea = $user_crea;
return $this;
}
public function getUserModifica(): ?int
{
return $this->user_modifica;
}
public function setUserModifica(int $user_modifica): self
{
$this->user_modifica = $user_modifica;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeInterface $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updated_at;
}
public function setUpdatedAt(\DateTimeInterface $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
/**
* @return Collection|Agenda[]
*/
public function getAgendas(): Collection
{
return $this->agendas;
}
public function addAgenda(Agenda $agenda): self
{
if (!$this->agendas->contains($agenda)) {
$this->agendas[] = $agenda;
$agenda->setEspecialidad($this);
}
return $this;
}
public function removeAgenda(Agenda $agenda): self
{
if ($this->agendas->removeElement($agenda)) {
// set the owning side to null (unless already changed)
if ($agenda->getEspecialidad() === $this) {
$agenda->setEspecialidad(null);
}
}
return $this;
}
/**
* @return Collection|LogAgenda[]
*/
public function getLogAgendas(): Collection
{
return $this->logAgendas;
}
public function addLogAgenda(LogAgenda $logAgenda): self
{
if (!$this->logAgendas->contains($logAgenda)) {
$this->logAgendas[] = $logAgenda;
$logAgenda->setEspecialidad($this);
}
return $this;
}
public function removeLogAgenda(LogAgenda $logAgenda): self
{
if ($this->logAgendas->removeElement($logAgenda)) {
// set the owning side to null (unless already changed)
if ($logAgenda->getEspecialidad() === $this) {
$logAgenda->setEspecialidad(null);
}
}
return $this;
}
/**
* @return Collection|User[]
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
$user->setEspecialidad($this);
}
return $this;
}
public function removeUser(User $user): self
{
if ($this->users->removeElement($user)) {
// set the owning side to null (unless already changed)
if ($user->getEspecialidad() === $this) {
$user->setEspecialidad(null);
}
}
return $this;
}
/**
* Generates the magic method
*
*/
public function __toString(){
// to show the name of the Category in the select
return $this->nombre;
// to show the id of the Category in the select
// return $this->id;
}
public function getDependencia(): ?Dependencia
{
return $this->dependencia;
}
public function setDependencia(?Dependencia $dependencia): self
{
$this->dependencia = $dependencia;
return $this;
}
}