src/Entity/Especialidad.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EspecialidadRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=EspecialidadRepository::class)
  9.  */
  10. class Especialidad
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $nombre;
  22.     /**
  23.      * @ORM\Column(type="boolean")
  24.      */
  25.     private $estado;
  26.     /**
  27.      * @ORM\Column(type="string", length=50)
  28.      */
  29.     private $ip_crea;
  30.     /**
  31.      * @ORM\Column(type="string", length=50)
  32.      */
  33.     private $ip_modifica;
  34.     /**
  35.      * @ORM\Column(type="integer")
  36.      */
  37.     private $user_crea;
  38.     /**
  39.      * @ORM\Column(type="integer")
  40.      */
  41.     private $user_modifica;
  42.     /**
  43.      * @ORM\Column(type="datetime")
  44.      */
  45.     private $created_at;
  46.     /**
  47.      * @ORM\Column(type="datetime")
  48.      */
  49.     private $updated_at;
  50.     /**
  51.      * @ORM\OneToMany(targetEntity=Agenda::class, mappedBy="especialidad")
  52.      */
  53.     private $agendas;
  54.     /**
  55.      * @ORM\OneToMany(targetEntity=LogAgenda::class, mappedBy="especialidad")
  56.      */
  57.     private $logAgendas;
  58.     /**
  59.      * @ORM\OneToMany(targetEntity=User::class, mappedBy="especialidad")
  60.      */
  61.     private $users;
  62.     
  63.     /**
  64.     * @ORM\ManyToOne(targetEntity=Dependencia::class)
  65.     */
  66.     private $dependencia;
  67.     public function __construct()
  68.     {
  69.         $this->agendas = new ArrayCollection();
  70.         $this->logAgendas = new ArrayCollection();
  71.         $this->users = new ArrayCollection();
  72.     }
  73.     public function getId(): ?int
  74.     {
  75.         return $this->id;
  76.     }
  77.     public function getNombre(): ?string
  78.     {
  79.         return $this->nombre;
  80.     }
  81.     public function setNombre(string $nombre): self
  82.     {
  83.         $this->nombre $nombre;
  84.         return $this;
  85.     }
  86.     public function getEstado(): ?bool
  87.     {
  88.         return $this->estado;
  89.     }
  90.     public function setEstado(bool $estado): self
  91.     {
  92.         $this->estado $estado;
  93.         return $this;
  94.     }
  95.     public function getIpCrea(): ?string
  96.     {
  97.         return $this->ip_crea;
  98.     }
  99.     public function setIpCrea(string $ip_crea): self
  100.     {
  101.         $this->ip_crea $ip_crea;
  102.         return $this;
  103.     }
  104.     public function getIpModifica(): ?string
  105.     {
  106.         return $this->ip_modifica;
  107.     }
  108.     public function setIpModifica(string $ip_modifica): self
  109.     {
  110.         $this->ip_modifica $ip_modifica;
  111.         return $this;
  112.     }
  113.     public function getUserCrea(): ?int
  114.     {
  115.         return $this->user_crea;
  116.     }
  117.     public function setUserCrea(int $user_crea): self
  118.     {
  119.         $this->user_crea $user_crea;
  120.         return $this;
  121.     }
  122.     public function getUserModifica(): ?int
  123.     {
  124.         return $this->user_modifica;
  125.     }
  126.     public function setUserModifica(int $user_modifica): self
  127.     {
  128.         $this->user_modifica $user_modifica;
  129.         return $this;
  130.     }
  131.     public function getCreatedAt(): ?\DateTimeInterface
  132.     {
  133.         return $this->created_at;
  134.     }
  135.     public function setCreatedAt(\DateTimeInterface $created_at): self
  136.     {
  137.         $this->created_at $created_at;
  138.         return $this;
  139.     }
  140.     public function getUpdatedAt(): ?\DateTimeInterface
  141.     {
  142.         return $this->updated_at;
  143.     }
  144.     public function setUpdatedAt(\DateTimeInterface $updated_at): self
  145.     {
  146.         $this->updated_at $updated_at;
  147.         return $this;
  148.     }
  149.     /**
  150.      * @return Collection|Agenda[]
  151.      */
  152.     public function getAgendas(): Collection
  153.     {
  154.         return $this->agendas;
  155.     }
  156.     public function addAgenda(Agenda $agenda): self
  157.     {
  158.         if (!$this->agendas->contains($agenda)) {
  159.             $this->agendas[] = $agenda;
  160.             $agenda->setEspecialidad($this);
  161.         }
  162.         return $this;
  163.     }
  164.     public function removeAgenda(Agenda $agenda): self
  165.     {
  166.         if ($this->agendas->removeElement($agenda)) {
  167.             // set the owning side to null (unless already changed)
  168.             if ($agenda->getEspecialidad() === $this) {
  169.                 $agenda->setEspecialidad(null);
  170.             }
  171.         }
  172.         return $this;
  173.     }
  174.     /**
  175.      * @return Collection|LogAgenda[]
  176.      */
  177.     public function getLogAgendas(): Collection
  178.     {
  179.         return $this->logAgendas;
  180.     }
  181.     public function addLogAgenda(LogAgenda $logAgenda): self
  182.     {
  183.         if (!$this->logAgendas->contains($logAgenda)) {
  184.             $this->logAgendas[] = $logAgenda;
  185.             $logAgenda->setEspecialidad($this);
  186.         }
  187.         return $this;
  188.     }
  189.     public function removeLogAgenda(LogAgenda $logAgenda): self
  190.     {
  191.         if ($this->logAgendas->removeElement($logAgenda)) {
  192.             // set the owning side to null (unless already changed)
  193.             if ($logAgenda->getEspecialidad() === $this) {
  194.                 $logAgenda->setEspecialidad(null);
  195.             }
  196.         }
  197.         return $this;
  198.     }
  199.     /**
  200.      * @return Collection|User[]
  201.      */
  202.     public function getUsers(): Collection
  203.     {
  204.         return $this->users;
  205.     }
  206.     public function addUser(User $user): self
  207.     {
  208.         if (!$this->users->contains($user)) {
  209.             $this->users[] = $user;
  210.             $user->setEspecialidad($this);
  211.         }
  212.         return $this;
  213.     }
  214.     public function removeUser(User $user): self
  215.     {
  216.         if ($this->users->removeElement($user)) {
  217.             // set the owning side to null (unless already changed)
  218.             if ($user->getEspecialidad() === $this) {
  219.                 $user->setEspecialidad(null);
  220.             }
  221.         }
  222.         return $this;
  223.     }
  224.     
  225.     /**
  226.      * Generates the magic method
  227.      *
  228.      */
  229.     public function __toString(){
  230.         // to show the name of the Category in the select
  231.         return $this->nombre;
  232.         // to show the id of the Category in the select
  233.         // return $this->id;
  234.     }
  235.     
  236.     public function getDependencia(): ?Dependencia
  237.     {
  238.         return $this->dependencia;
  239.     }
  240.     public function setDependencia(?Dependencia $dependencia): self
  241.     {
  242.         $this->dependencia $dependencia;
  243.         return $this;
  244.     }
  245. }