<?php
namespace App\Entity;
use App\Repository\UserRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @ORM\Entity(repositoryClass=UserRepository::class)
*/
class User implements UserInterface
{
const REGISTRO_EXITOSO = 'Se ha registrado Exitosamente !!';
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=180, unique=true)
*/
private $username;
/**
* @ORM\Column(type="string", length=100)
*/
private $apellido1;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $apellido2;
/**
* @ORM\Column(type="string", length=100)
*/
private $nombre1;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $nombre2;
/**
* @ORM\Column(type="json")
*/
private $roles = [];
/**
* @var string The hashed password
* @ORM\Column(type="string")
*/
private $password;
/**
* @ORM\ManyToOne(targetEntity=TipoUsuario::class, inversedBy="users")
* @ORM\JoinColumn(nullable=false)
*/
private $tipousuario;
/**
* @ORM\Column(type="string", length=13, unique=true)
*/
protected $cedula;
/**
* @ORM\OneToMany(targetEntity=Paciente::class, mappedBy="user")
*/
private $pacientes;
/**
* @ORM\OneToMany(targetEntity=Agenda::class, mappedBy="doctor")
*/
private $agendas;
/**
* @ORM\Column(type="boolean")
*/
private $estado;
/**
* @ORM\OneToMany(targetEntity=LogAgenda::class, mappedBy="doctor")
*/
private $logAgendas;
/**
* @ORM\OneToMany(targetEntity=Receta::class, mappedBy="doctor")
*/
private $recetas;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $firma;
/**
* @ORM\ManyToOne(targetEntity=Especialidad::class, inversedBy="users")
*/
private $especialidad;
/**
* @ORM\OneToMany(targetEntity=ExamenOrden::class, mappedBy="doctor")
*/
private $examenOrdens;
/**
* @ORM\OneToMany(targetEntity=Orden012::class, mappedBy="doctor")
*/
private $orden012s;
/**
* @ORM\OneToMany(targetEntity=PlanoCabecera::class, mappedBy="doctor")
*/
private $planoCabeceras;
/**
* @ORM\OneToMany(targetEntity=Epicrisis::class, mappedBy="doctor")
*/
private $epicrises;
/**
* @ORM\OneToMany(targetEntity=LabProtocolo::class, mappedBy="doctor")
*/
private $labProtocolos;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $cod_senescyt;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $titulo;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $titulo_abrev;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $color;
/**
* @ORM\Column(type="string", length=5, nullable=true)
*/
private $dr;
public function getId(): ?int
{
return $this->id;
}
/**
* A visual identifier that represents this user.
*
* @see UserInterface
*/
public function getUsername(): string
{
return (string) $this->username;
}
public function setUsername(string $username): self
{
$this->username = $username;
return $this;
}
/**
* @see UserInterface
*/
public function getRoles(): array
{
$roles = $this->roles;
// guarantee every user at least has ROLE_USER
$roles[] = 'ROLE_USER';
return array_unique($roles);
}
public function setRoles(array $roles): self
{
$this->roles = $roles;
return $this;
}
/**
* @see UserInterface
*/
public function getPassword(): string
{
return (string) $this->password;
}
public function setPassword(string $password): self
{
$this->password = $password;
return $this;
}
/**
* @see UserInterface
*/
public function getSalt()
{
// not needed when using the "bcrypt" algorithm in security.yaml
}
/**
* @see UserInterface
*/
public function eraseCredentials()
{
// If you store any temporary, sensitive data on the user, clear it here
// $this->plainPassword = null;
}
public function getApellido1(): ?string
{
return $this->apellido1;
}
public function setApellido1(string $apellido1): self
{
$this->apellido1 = $apellido1;
return $this;
}
public function getApellido2(): ?string
{
return $this->apellido2;
}
public function setApellido2(?string $apellido2): self
{
$this->apellido2 = $apellido2;
return $this;
}
public function getNombre1(): ?string
{
return $this->nombre1;
}
public function setNombre1(string $nombre1): self
{
$this->nombre1 = $nombre1;
return $this;
}
public function getNombre2(): ?string
{
return $this->nombre2;
}
public function setNombre2(?string $nombre2): self
{
$this->nombre2 = $nombre2;
return $this;
}
public function __construct()
{
$this->roles = ['ROLE_USER'];
$this->pacientes = new ArrayCollection();
$this->agendas = new ArrayCollection();
$this->logAgendas = new ArrayCollection();
$this->recetas = new ArrayCollection();
$this->examenOrdens = new ArrayCollection();
$this->orden012s = new ArrayCollection();
$this->planoCabeceras = new ArrayCollection();
$this->epicrises = new ArrayCollection();
$this->ip_crea = new ArrayCollection();
$this->labProtocolos = new ArrayCollection();
}
public function getTipousuario(): ?TipoUsuario
{
return $this->tipousuario;
}
public function setTipousuario(?TipoUsuario $tipousuario): self
{
$this->tipousuario = $tipousuario;
return $this;
}
public function getCedula(): ?string
{
return $this->cedula;
}
public function setCedula(string $cedula): self
{
$this->cedula = $cedula;
return $this;
}
/**
* @return Collection|Paciente[]
*/
public function getPacientes(): Collection
{
return $this->pacientes;
}
public function addPaciente(Paciente $paciente): self
{
if (!$this->pacientes->contains($paciente)) {
$this->pacientes[] = $paciente;
$paciente->setUser($this);
}
return $this;
}
public function removePaciente(Paciente $paciente): self
{
if ($this->pacientes->contains($paciente)) {
$this->pacientes->removeElement($paciente);
// set the owning side to null (unless already changed)
if ($paciente->getUser() === $this) {
$paciente->setUser(null);
}
}
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->setDoctor($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->getDoctor() === $this) {
$agenda->setDoctor(null);
}
}
return $this;
}
public function __toString(){
// to show the name of the Category in the select
return $this->apellido1;
// to show the id of the Category in the select
// return $this->id;
}
public function getEstado(): ?bool
{
return $this->estado;
}
public function setEstado(bool $estado): self
{
$this->estado = $estado;
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->setDoctor($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->getDoctor() === $this) {
$logAgenda->setDoctor(null);
}
}
return $this;
}
/**
* @return Collection|Receta[]
*/
public function getRecetas(): Collection
{
return $this->recetas;
}
public function addReceta(Receta $receta): self
{
if (!$this->recetas->contains($receta)) {
$this->recetas[] = $receta;
$receta->setDoctor($this);
}
return $this;
}
public function removeReceta(Receta $receta): self
{
if ($this->recetas->removeElement($receta)) {
// set the owning side to null (unless already changed)
if ($receta->getDoctor() === $this) {
$receta->setDoctor(null);
}
}
return $this;
}
public function getFirma(): ?string
{
return $this->firma;
}
public function setFirma(string $firma): self
{
$this->firma = $firma;
return $this;
}
public function getEspecialidad(): ?Especialidad
{
return $this->especialidad;
}
public function setEspecialidad(?Especialidad $especialidad): self
{
$this->especialidad = $especialidad;
return $this;
}
/**
* @return Collection|ExamenOrden[]
*/
public function getExamenOrdens(): Collection
{
return $this->examenOrdens;
}
public function addExamenOrden(ExamenOrden $examenOrden): self
{
if (!$this->examenOrdens->contains($examenOrden)) {
$this->examenOrdens[] = $examenOrden;
$examenOrden->setDoctor($this);
}
return $this;
}
public function removeExamenOrden(ExamenOrden $examenOrden): self
{
if ($this->examenOrdens->removeElement($examenOrden)) {
// set the owning side to null (unless already changed)
if ($examenOrden->getDoctor() === $this) {
$examenOrden->setDoctor(null);
}
}
return $this;
}
/**
* @return Collection|Orden012[]
*/
public function getOrden012s(): Collection
{
return $this->orden012s;
}
public function addOrden012(Orden012 $orden012): self
{
if (!$this->orden012s->contains($orden012)) {
$this->orden012s[] = $orden012;
$orden012->setDoctor($this);
}
return $this;
}
public function removeOrden012(Orden012 $orden012): self
{
if ($this->orden012s->removeElement($orden012)) {
// set the owning side to null (unless already changed)
if ($orden012->getDoctor() === $this) {
$orden012->setDoctor(null);
}
}
return $this;
}
/**
* @return Collection|PlanoCabecera[]
*/
public function getPlanoCabeceras(): Collection
{
return $this->planoCabeceras;
}
public function addPlanoCabecera(PlanoCabecera $planoCabecera): self
{
if (!$this->planoCabeceras->contains($planoCabecera)) {
$this->planoCabeceras[] = $planoCabecera;
$planoCabecera->setDoctor($this);
}
return $this;
}
public function removePlanoCabecera(PlanoCabecera $planoCabecera): self
{
if ($this->planoCabeceras->removeElement($planoCabecera)) {
// set the owning side to null (unless already changed)
if ($planoCabecera->getDoctor() === $this) {
$planoCabecera->setDoctor(null);
}
}
return $this;
}
/**
* @return Collection|Epicrisis[]
*/
public function getEpicrises(): Collection
{
return $this->epicrises;
}
public function addEpicrisis(Epicrisis $epicrisis): self
{
if (!$this->epicrises->contains($epicrisis)) {
$this->epicrises[] = $epicrisis;
$epicrisis->setDoctor($this);
}
return $this;
}
public function removeEpicrisis(Epicrisis $epicrisis): self
{
if ($this->epicrises->removeElement($epicrisis)) {
// set the owning side to null (unless already changed)
if ($epicrisis->getDoctor() === $this) {
$epicrisis->setDoctor(null);
}
}
return $this;
}
/**
* @return Collection|LabProtocolo[]
*/
public function getLabProtocolos(): Collection
{
return $this->labProtocolos;
}
public function addLabProtocolo(LabProtocolo $labProtocolo): self
{
if (!$this->labProtocolos->contains($labProtocolo)) {
$this->labProtocolos[] = $labProtocolo;
$labProtocolo->setDoctor($this);
}
return $this;
}
public function removeLabProtocolo(LabProtocolo $labProtocolo): self
{
if ($this->labProtocolos->removeElement($labProtocolo)) {
// set the owning side to null (unless already changed)
if ($labProtocolo->getDoctor() === $this) {
$labProtocolo->setDoctor(null);
}
}
return $this;
}
public function getCodSenescyt(): ?string
{
return $this->cod_senescyt;
}
public function setCodSenescyt(?string $cod_senescyt): self
{
$this->cod_senescyt = $cod_senescyt;
return $this;
}
public function getTitulo(): ?string
{
return $this->titulo;
}
public function setTitulo(?string $titulo): self
{
$this->titulo = $titulo;
return $this;
}
public function getTituloAbrev(): ?string
{
return $this->titulo_abrev;
}
public function setTituloAbrev(?string $titulo_abrev): self
{
$this->titulo_abrev = $titulo_abrev;
return $this;
}
public function getColor(): ?string
{
return $this->color;
}
public function setColor(?string $color): self
{
$this->color = $color;
return $this;
}
public function getDr(): ?string
{
return $this->dr;
}
public function setDr(?string $dr): self
{
$this->dr = $dr;
return $this;
}
}