src/Entity/Medicina.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\MedicinaRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use DateTime;
  8. /**
  9.  * @ORM\Entity(repositoryClass=MedicinaRepository::class)
  10.  * @ORM\HasLifecycleCallbacks
  11.  */
  12. class Medicina
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255)
  22.      */
  23.     private $nombre;
  24.     /**
  25.      * @ORM\Column(type="string", length=255, nullable=true)
  26.      */
  27.     private $presentacion;
  28.     
  29.     /**
  30.      * @ORM\Column(type="string", length=255, nullable=true)
  31.      */
  32.     private $indicaciones;
  33.     /**
  34.      * @ORM\Column(type="boolean")
  35.      */
  36.     private $estado;
  37.     /**
  38.      * @ORM\Column(type="string", length=50)
  39.      */
  40.     private $ip_crea;
  41.     /**
  42.      * @ORM\Column(type="string", length=50)
  43.      */
  44.     private $ip_modifica;
  45.     /**
  46.      * @ORM\Column(type="integer")
  47.      */
  48.     private $user_crea;
  49.     /**
  50.      * @ORM\Column(type="integer")
  51.      */
  52.     private $user_modifica;
  53.     /**
  54.      * @ORM\Column(type="datetime")
  55.      */
  56.     private $created_at;
  57.     /**
  58.      * @ORM\Column(type="datetime")
  59.      */
  60.     private $updated_at;
  61.     /**
  62.      * @ORM\OneToMany(targetEntity=RecetaDetalle::class, mappedBy="medicina")
  63.      */
  64.     private $recetaDetalles;
  65.     /**
  66.      * @ORM\ManyToMany(targetEntity=Generico::class, inversedBy="medicinas")
  67.      */
  68.     private $generico;
  69.     /**
  70.      * @ORM\Column(type="string", length=50)
  71.      */
  72.     private $codigo;
  73.     /**
  74.      * @ORM\Column(type="decimal", precision=10, scale=4)
  75.      */
  76.     private $valor;
  77.     /**
  78.      * @ORM\Column(type="decimal", precision=10, scale=4)
  79.      */
  80.     private $iva;
  81.     
  82.     /**
  83.      * @ORM\Column(type="smallint")
  84.      */
  85.     private $tipo;
  86.     /**
  87.      * @ORM\OneToOne(targetEntity=Producto::class)
  88.      * @ORM\JoinColumn(name="producto_id", referencedColumnName="id", nullable=true)
  89.      */
  90.     private $producto;
  91.     public function __construct()
  92.     {
  93.         $this->recetaDetalles = new ArrayCollection();
  94.         $this->generico = new ArrayCollection();
  95.     }
  96.     public function getId(): ?int
  97.     {
  98.         return $this->id;
  99.     }
  100.     public function getNombre(): ?string
  101.     {
  102.         return $this->nombre;
  103.     }
  104.     public function setNombre(string $nombre): self
  105.     {
  106.         $this->nombre $nombre;
  107.         return $this;
  108.     }
  109.     public function getPresentacion(): ?string
  110.     {
  111.         return $this->presentacion;
  112.     }
  113.     public function setPresentacion(string $presentacion): self
  114.     {
  115.         $this->presentacion $presentacion;
  116.         return $this;
  117.     }
  118.     
  119.     public function getIndicaciones(): ?string
  120.     {
  121.         return $this->indicaciones;
  122.     }
  123.     public function setIndicaciones(string $indicaciones): self
  124.     {
  125.         $this->indicaciones $indicaciones;
  126.         return $this;
  127.     }
  128.     public function getEstado(): ?bool
  129.     {
  130.         return $this->estado;
  131.     }
  132.     public function setEstado(bool $estado): self
  133.     {
  134.         $this->estado $estado;
  135.         return $this;
  136.     }
  137.     public function getIpCrea(): ?string
  138.     {
  139.         return $this->ip_crea;
  140.     }
  141.     public function setIpCrea(string $ip_crea): self
  142.     {
  143.         $this->ip_crea $ip_crea;
  144.         return $this;
  145.     }
  146.     public function getIpModifica(): ?string
  147.     {
  148.         return $this->ip_modifica;
  149.     }
  150.     public function setIpModifica(string $ip_modifica): self
  151.     {
  152.         $this->ip_modifica $ip_modifica;
  153.         return $this;
  154.     }
  155.     public function getUserCrea(): ?int
  156.     {
  157.         return $this->user_crea;
  158.     }
  159.     public function setUserCrea(int $user_crea): self
  160.     {
  161.         $this->user_crea $user_crea;
  162.         return $this;
  163.     }
  164.     public function getUserModifica(): ?int
  165.     {
  166.         return $this->user_modifica;
  167.     }
  168.     public function setUserModifica(int $user_modifica): self
  169.     {
  170.         $this->user_modifica $user_modifica;
  171.         return $this;
  172.     }
  173.     public function getCreatedAt(): ?\DateTimeInterface
  174.     {
  175.         return $this->created_at;
  176.     }
  177.     public function setCreatedAt(\DateTimeInterface $created_at): self
  178.     {
  179.         $this->created_at $created_at;
  180.         return $this;
  181.     }
  182.     public function getUpdatedAt(): ?\DateTimeInterface
  183.     {
  184.         return $this->updated_at;
  185.     }
  186.     public function setUpdatedAt(\DateTimeInterface $updated_at): self
  187.     {
  188.         $this->updated_at $updated_at;
  189.         return $this;
  190.     }
  191.     public function getTipo(): ?int
  192.     {
  193.         return $this->tipo;
  194.     }
  195.     public function setTipo(int $tipo): self
  196.     {
  197.         $this->tipo $tipo;
  198.         return $this;
  199.     }
  200.     /**
  201.      * @return Collection|RecetaDetalle[]
  202.      */
  203.     public function getRecetaDetalles(): Collection
  204.     {
  205.         return $this->recetaDetalles;
  206.     }
  207.     public function addRecetaDetalle(RecetaDetalle $recetaDetalle): self
  208.     {
  209.         if (!$this->recetaDetalles->contains($recetaDetalle)) {
  210.             $this->recetaDetalles[] = $recetaDetalle;
  211.             $recetaDetalle->setMedicina($this);
  212.         }
  213.         return $this;
  214.     }
  215.     public function removeRecetaDetalle(RecetaDetalle $recetaDetalle): self
  216.     {
  217.         if ($this->recetaDetalles->removeElement($recetaDetalle)) {
  218.             // set the owning side to null (unless already changed)
  219.             if ($recetaDetalle->getMedicina() === $this) {
  220.                 $recetaDetalle->setMedicina(null);
  221.             }
  222.         }
  223.         return $this;
  224.     }
  225.     /**
  226.      * @return Collection|Generico[]
  227.      */
  228.     public function getGenerico(): Collection
  229.     {
  230.         return $this->generico;
  231.     }
  232.     public function addGenerico(Generico $generico): self
  233.     {
  234.         if (!$this->generico->contains($generico)) {
  235.             $this->generico[] = $generico;
  236.         }
  237.         return $this;
  238.     }
  239.     public function removeGenerico(Generico $generico): self
  240.     {
  241.         $this->generico->removeElement($generico);
  242.         return $this;
  243.     }
  244.     public function getCodigo(): ?string
  245.     {
  246.         return $this->codigo;
  247.     }
  248.     public function setCodigo(string $codigo): self
  249.     {
  250.         $this->codigo $codigo;
  251.         return $this;
  252.     }
  253.     public function getValor(): ?string
  254.     {
  255.         return $this->valor;
  256.     }
  257.     public function setValor(string $valor): self
  258.     {
  259.         $this->valor $valor;
  260.         return $this;
  261.     }
  262.     public function getIva(): ?string
  263.     {
  264.         return $this->iva;
  265.     }
  266.     public function setIva(string $iva): self
  267.     {
  268.         $this->iva $iva;
  269.         return $this;
  270.     }
  271.     
  272.     /**
  273.      * @ORM\PrePersist
  274.      * @ORM\PreUpdate
  275.      */
  276.     public function updatedTimestamps(): void
  277.     {
  278.         $dateTimeNow = new DateTime('now');
  279.         $this->setUpdatedAt($dateTimeNow);
  280.         if ($this->getCreatedAt() === null) {
  281.             $this->setCreatedAt($dateTimeNow);
  282.         }
  283.     }
  284.     public function getProducto(): ?Producto
  285.     {
  286.         return $this->producto;
  287.     }
  288.     
  289.     public function setProducto(?Producto $producto): self
  290.     {
  291.         $this->producto $producto;
  292.     
  293.         return $this;
  294.     }
  295. }