src/Entity/User.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Security\Core\User\UserInterface;
  8. /**
  9.  * @ORM\Entity(repositoryClass=UserRepository::class)
  10.  */
  11. class User implements UserInterface
  12. {
  13.     const REGISTRO_EXITOSO 'Se ha registrado Exitosamente !!';
  14.     /**
  15.      * @ORM\Id()
  16.      * @ORM\GeneratedValue()
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=180, unique=true)
  22.      */
  23.     private $username;
  24.     /**
  25.     * @ORM\Column(type="string", length=100)
  26.     */
  27.     private $apellido1;
  28.     /**
  29.     * @ORM\Column(type="string", length=100, nullable=true)
  30.     */
  31.     private $apellido2;
  32.     /**
  33.     * @ORM\Column(type="string", length=100)
  34.     */
  35.     private $nombre1;
  36.     /**
  37.     * @ORM\Column(type="string", length=100, nullable=true)
  38.     */
  39.     private $nombre2;
  40.     /**
  41.      * @ORM\Column(type="json")
  42.      */
  43.     private $roles = [];
  44.     /**
  45.      * @var string The hashed password
  46.      * @ORM\Column(type="string")
  47.      */
  48.     private $password;
  49.     /**
  50.      * @ORM\ManyToOne(targetEntity=TipoUsuario::class, inversedBy="users")
  51.      * @ORM\JoinColumn(nullable=false)
  52.      */
  53.     private $tipousuario;
  54.     /**
  55.      * @ORM\Column(type="string", length=13, unique=true)
  56.      */
  57.     protected $cedula;
  58.     /**
  59.      * @ORM\OneToMany(targetEntity=Paciente::class, mappedBy="user")
  60.      */
  61.     private $pacientes;
  62.     /**
  63.      * @ORM\OneToMany(targetEntity=Agenda::class, mappedBy="doctor")
  64.      */
  65.     private $agendas;
  66.     /**
  67.      * @ORM\Column(type="boolean")
  68.      */
  69.     private $estado;
  70.     /**
  71.      * @ORM\OneToMany(targetEntity=LogAgenda::class, mappedBy="doctor")
  72.      */
  73.     private $logAgendas;
  74.     /**
  75.      * @ORM\OneToMany(targetEntity=Receta::class, mappedBy="doctor")
  76.      */
  77.     private $recetas;
  78.     /**
  79.      * @ORM\Column(type="string", length=50, nullable=true)
  80.      */
  81.     private $firma;
  82.     /**
  83.      * @ORM\ManyToOne(targetEntity=Especialidad::class, inversedBy="users")
  84.      */
  85.     private $especialidad;
  86.     /**
  87.      * @ORM\OneToMany(targetEntity=ExamenOrden::class, mappedBy="doctor")
  88.      */
  89.     private $examenOrdens;
  90.     /**
  91.      * @ORM\OneToMany(targetEntity=Orden012::class, mappedBy="doctor")
  92.      */
  93.     private $orden012s;
  94.     /**
  95.      * @ORM\OneToMany(targetEntity=PlanoCabecera::class, mappedBy="doctor")
  96.      */
  97.     private $planoCabeceras;
  98.     /**
  99.      * @ORM\OneToMany(targetEntity=Epicrisis::class, mappedBy="doctor")
  100.      */
  101.     private $epicrises;
  102.   
  103.     /**
  104.      * @ORM\OneToMany(targetEntity=LabProtocolo::class, mappedBy="doctor")
  105.      */
  106.     private $labProtocolos;
  107.     
  108.      /**
  109.      * @ORM\Column(type="string", length=255, nullable=true)
  110.      */
  111.     private $cod_senescyt;
  112.     /**
  113.      * @ORM\Column(type="string", length=100, nullable=true)
  114.      */
  115.     private $titulo;
  116.     
  117.     /**
  118.      * @ORM\Column(type="string", length=50, nullable=true)
  119.      */
  120.     private $titulo_abrev;
  121.     
  122.     /**
  123.      * @ORM\Column(type="string", length=50, nullable=true)
  124.      */
  125.     private $color;
  126.     
  127.     /**
  128.      * @ORM\Column(type="string", length=5, nullable=true)
  129.      */
  130.     private $dr;
  131.     public function getId(): ?int
  132.     {
  133.         return $this->id;
  134.     }
  135.     /**
  136.      * A visual identifier that represents this user.
  137.      *
  138.      * @see UserInterface
  139.      */
  140.     public function getUsername(): string
  141.     {
  142.         return (string) $this->username;
  143.     }
  144.     public function setUsername(string $username): self
  145.     {
  146.         $this->username $username;
  147.         return $this;
  148.     }
  149.     /**
  150.      * @see UserInterface
  151.      */
  152.     public function getRoles(): array
  153.     {
  154.         $roles $this->roles;
  155.         // guarantee every user at least has ROLE_USER
  156.         $roles[] = 'ROLE_USER';
  157.         return array_unique($roles);
  158.     }
  159.     public function setRoles(array $roles): self
  160.     {
  161.         $this->roles $roles;
  162.         return $this;
  163.     }
  164.     /**
  165.      * @see UserInterface
  166.      */
  167.     public function getPassword(): string
  168.     {
  169.         return (string) $this->password;
  170.     }
  171.     public function setPassword(string $password): self
  172.     {
  173.         $this->password $password;
  174.         return $this;
  175.     }
  176.     /**
  177.      * @see UserInterface
  178.      */
  179.     public function getSalt()
  180.     {
  181.         // not needed when using the "bcrypt" algorithm in security.yaml
  182.     }
  183.     /**
  184.      * @see UserInterface
  185.      */
  186.     public function eraseCredentials()
  187.     {
  188.         // If you store any temporary, sensitive data on the user, clear it here
  189.         // $this->plainPassword = null;
  190.     }
  191.     public function getApellido1(): ?string
  192.     {
  193.         return $this->apellido1;
  194.     }
  195.     public function setApellido1(string $apellido1): self
  196.     {
  197.         $this->apellido1 $apellido1;
  198.         return $this;
  199.     }
  200.     public function getApellido2(): ?string
  201.     {
  202.         return $this->apellido2;
  203.     }
  204.     public function setApellido2(?string $apellido2): self
  205.     {
  206.         $this->apellido2 $apellido2;
  207.         return $this;
  208.     }
  209.     public function getNombre1(): ?string
  210.     {
  211.         return $this->nombre1;
  212.     }
  213.     public function setNombre1(string $nombre1): self
  214.     {
  215.         $this->nombre1 $nombre1;
  216.         return $this;
  217.     }
  218.     public function getNombre2(): ?string
  219.     {
  220.         return $this->nombre2;
  221.     }
  222.     public function setNombre2(?string $nombre2): self
  223.     {
  224.         $this->nombre2 $nombre2;
  225.         return $this;
  226.     }
  227.     public function __construct()
  228.     {
  229.         $this->roles = ['ROLE_USER'];
  230.         $this->pacientes = new ArrayCollection();
  231.         $this->agendas = new ArrayCollection();
  232.         $this->logAgendas = new ArrayCollection();
  233.         $this->recetas = new ArrayCollection();
  234.         $this->examenOrdens = new ArrayCollection();
  235.         $this->orden012s = new ArrayCollection();
  236.         $this->planoCabeceras = new ArrayCollection();
  237.         $this->epicrises = new ArrayCollection();
  238.         $this->ip_crea = new ArrayCollection();
  239.         $this->labProtocolos = new ArrayCollection();
  240.     }
  241.     public function getTipousuario(): ?TipoUsuario
  242.     {
  243.         return $this->tipousuario;
  244.     }
  245.     public function setTipousuario(?TipoUsuario $tipousuario): self
  246.     {
  247.         $this->tipousuario $tipousuario;
  248.         return $this;
  249.     }
  250.     public function getCedula(): ?string
  251.     {
  252.         return $this->cedula;
  253.     }
  254.     public function setCedula(string $cedula): self
  255.     {
  256.         $this->cedula $cedula;
  257.         return $this;
  258.     }
  259.     /**
  260.      * @return Collection|Paciente[]
  261.      */
  262.     public function getPacientes(): Collection
  263.     {
  264.         return $this->pacientes;
  265.     }
  266.     public function addPaciente(Paciente $paciente): self
  267.     {
  268.         if (!$this->pacientes->contains($paciente)) {
  269.             $this->pacientes[] = $paciente;
  270.             $paciente->setUser($this);
  271.         }
  272.         return $this;
  273.     }
  274.     public function removePaciente(Paciente $paciente): self
  275.     {
  276.         if ($this->pacientes->contains($paciente)) {
  277.             $this->pacientes->removeElement($paciente);
  278.             // set the owning side to null (unless already changed)
  279.             if ($paciente->getUser() === $this) {
  280.                 $paciente->setUser(null);
  281.             }
  282.         }
  283.         return $this;
  284.     }
  285.     /**
  286.      * @return Collection|Agenda[]
  287.      */
  288.     public function getAgendas(): Collection
  289.     {
  290.         return $this->agendas;
  291.     }
  292.     public function addAgenda(Agenda $agenda): self
  293.     {
  294.         if (!$this->agendas->contains($agenda)) {
  295.             $this->agendas[] = $agenda;
  296.             $agenda->setDoctor($this);
  297.         }
  298.         return $this;
  299.     }
  300.     public function removeAgenda(Agenda $agenda): self
  301.     {
  302.         if ($this->agendas->removeElement($agenda)) {
  303.             // set the owning side to null (unless already changed)
  304.             if ($agenda->getDoctor() === $this) {
  305.                 $agenda->setDoctor(null);
  306.             }
  307.         }
  308.         return $this;
  309.     }
  310.     public function __toString(){
  311.         // to show the name of the Category in the select
  312.         return $this->apellido1;
  313.         // to show the id of the Category in the select
  314.         // return $this->id;
  315.     }
  316.     public function getEstado(): ?bool
  317.     {
  318.         return $this->estado;
  319.     }
  320.     public function setEstado(bool $estado): self
  321.     {
  322.         $this->estado $estado;
  323.         return $this;
  324.     }
  325.     /**
  326.      * @return Collection|LogAgenda[]
  327.      */
  328.     public function getLogAgendas(): Collection
  329.     {
  330.         return $this->logAgendas;
  331.     }
  332.     public function addLogAgenda(LogAgenda $logAgenda): self
  333.     {
  334.         if (!$this->logAgendas->contains($logAgenda)) {
  335.             $this->logAgendas[] = $logAgenda;
  336.             $logAgenda->setDoctor($this);
  337.         }
  338.         return $this;
  339.     }
  340.     public function removeLogAgenda(LogAgenda $logAgenda): self
  341.     {
  342.         if ($this->logAgendas->removeElement($logAgenda)) {
  343.             // set the owning side to null (unless already changed)
  344.             if ($logAgenda->getDoctor() === $this) {
  345.                 $logAgenda->setDoctor(null);
  346.             }
  347.         }
  348.         return $this;
  349.     }
  350.     /**
  351.      * @return Collection|Receta[]
  352.      */
  353.     public function getRecetas(): Collection
  354.     {
  355.         return $this->recetas;
  356.     }
  357.     public function addReceta(Receta $receta): self
  358.     {
  359.         if (!$this->recetas->contains($receta)) {
  360.             $this->recetas[] = $receta;
  361.             $receta->setDoctor($this);
  362.         }
  363.         return $this;
  364.     }
  365.     public function removeReceta(Receta $receta): self
  366.     {
  367.         if ($this->recetas->removeElement($receta)) {
  368.             // set the owning side to null (unless already changed)
  369.             if ($receta->getDoctor() === $this) {
  370.                 $receta->setDoctor(null);
  371.             }
  372.         }
  373.         return $this;
  374.     }
  375.     public function getFirma(): ?string
  376.     {
  377.         return $this->firma;
  378.     }
  379.     public function setFirma(string $firma): self
  380.     {
  381.         $this->firma $firma;
  382.         return $this;
  383.     }
  384.     public function getEspecialidad(): ?Especialidad
  385.     {
  386.         return $this->especialidad;
  387.     }
  388.     public function setEspecialidad(?Especialidad $especialidad): self
  389.     {
  390.         $this->especialidad $especialidad;
  391.         return $this;
  392.     }
  393.     /**
  394.      * @return Collection|ExamenOrden[]
  395.      */
  396.     public function getExamenOrdens(): Collection
  397.     {
  398.         return $this->examenOrdens;
  399.     }
  400.     public function addExamenOrden(ExamenOrden $examenOrden): self
  401.     {
  402.         if (!$this->examenOrdens->contains($examenOrden)) {
  403.             $this->examenOrdens[] = $examenOrden;
  404.             $examenOrden->setDoctor($this);
  405.         }
  406.         return $this;
  407.     }
  408.     public function removeExamenOrden(ExamenOrden $examenOrden): self
  409.     {
  410.         if ($this->examenOrdens->removeElement($examenOrden)) {
  411.             // set the owning side to null (unless already changed)
  412.             if ($examenOrden->getDoctor() === $this) {
  413.                 $examenOrden->setDoctor(null);
  414.             }
  415.         }
  416.         return $this;
  417.     }
  418.     /**
  419.      * @return Collection|Orden012[]
  420.      */
  421.     public function getOrden012s(): Collection
  422.     {
  423.         return $this->orden012s;
  424.     }
  425.     public function addOrden012(Orden012 $orden012): self
  426.     {
  427.         if (!$this->orden012s->contains($orden012)) {
  428.             $this->orden012s[] = $orden012;
  429.             $orden012->setDoctor($this);
  430.         }
  431.         return $this;
  432.     }
  433.     public function removeOrden012(Orden012 $orden012): self
  434.     {
  435.         if ($this->orden012s->removeElement($orden012)) {
  436.             // set the owning side to null (unless already changed)
  437.             if ($orden012->getDoctor() === $this) {
  438.                 $orden012->setDoctor(null);
  439.             }
  440.         }
  441.         return $this;
  442.     }
  443.     /**
  444.      * @return Collection|PlanoCabecera[]
  445.      */
  446.     public function getPlanoCabeceras(): Collection
  447.     {
  448.         return $this->planoCabeceras;
  449.     }
  450.     public function addPlanoCabecera(PlanoCabecera $planoCabecera): self
  451.     {
  452.         if (!$this->planoCabeceras->contains($planoCabecera)) {
  453.             $this->planoCabeceras[] = $planoCabecera;
  454.             $planoCabecera->setDoctor($this);
  455.         }
  456.         return $this;
  457.     }
  458.     public function removePlanoCabecera(PlanoCabecera $planoCabecera): self
  459.     {
  460.         if ($this->planoCabeceras->removeElement($planoCabecera)) {
  461.             // set the owning side to null (unless already changed)
  462.             if ($planoCabecera->getDoctor() === $this) {
  463.                 $planoCabecera->setDoctor(null);
  464.             }
  465.         }
  466.         return $this;
  467.     }
  468.     /**
  469.      * @return Collection|Epicrisis[]
  470.      */
  471.     public function getEpicrises(): Collection
  472.     {
  473.         return $this->epicrises;
  474.     }
  475.     public function addEpicrisis(Epicrisis $epicrisis): self
  476.     {
  477.         if (!$this->epicrises->contains($epicrisis)) {
  478.             $this->epicrises[] = $epicrisis;
  479.             $epicrisis->setDoctor($this);
  480.         }
  481.         return $this;
  482.     }
  483.     public function removeEpicrisis(Epicrisis $epicrisis): self
  484.     {
  485.         if ($this->epicrises->removeElement($epicrisis)) {
  486.             // set the owning side to null (unless already changed)
  487.             if ($epicrisis->getDoctor() === $this) {
  488.                 $epicrisis->setDoctor(null);
  489.             }
  490.         }
  491.         return $this;
  492.     }
  493.     /**
  494.      * @return Collection|LabProtocolo[]
  495.      */
  496.     public function getLabProtocolos(): Collection
  497.     {
  498.         return $this->labProtocolos;
  499.     }
  500.     public function addLabProtocolo(LabProtocolo $labProtocolo): self
  501.     {
  502.         if (!$this->labProtocolos->contains($labProtocolo)) {
  503.             $this->labProtocolos[] = $labProtocolo;
  504.             $labProtocolo->setDoctor($this);
  505.         }
  506.         return $this;
  507.     }
  508.     public function removeLabProtocolo(LabProtocolo $labProtocolo): self
  509.     {
  510.         if ($this->labProtocolos->removeElement($labProtocolo)) {
  511.             // set the owning side to null (unless already changed)
  512.             if ($labProtocolo->getDoctor() === $this) {
  513.                 $labProtocolo->setDoctor(null);
  514.             }
  515.         }
  516.         return $this;
  517.     }
  518.     
  519.     public function getCodSenescyt(): ?string
  520.     {
  521.         return $this->cod_senescyt;
  522.     }
  523.     public function setCodSenescyt(?string $cod_senescyt): self
  524.     {
  525.         $this->cod_senescyt $cod_senescyt;
  526.         return $this;
  527.     }
  528.     public function getTitulo(): ?string
  529.     {
  530.         return $this->titulo;
  531.     }
  532.     public function setTitulo(?string $titulo): self
  533.     {
  534.         $this->titulo $titulo;
  535.         return $this;
  536.     }
  537.     
  538.     public function getTituloAbrev(): ?string
  539.     {
  540.         return $this->titulo_abrev;
  541.     }
  542.     public function setTituloAbrev(?string $titulo_abrev): self
  543.     {
  544.         $this->titulo_abrev $titulo_abrev;
  545.         return $this;
  546.     }
  547.     
  548.     public function getColor(): ?string
  549.     {
  550.         return $this->color;
  551.     }
  552.     public function setColor(?string $color): self
  553.     {
  554.         $this->color $color;
  555.         return $this;
  556.     }
  557.     
  558.     public function getDr(): ?string
  559.     {
  560.         return $this->dr;
  561.     }
  562.     public function setDr(?string $dr): self
  563.     {
  564.         $this->dr $dr;
  565.         return $this;
  566.     }
  567. }