src/Entity/Calidad/InsumoArticulo.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Calidad;
  3. use App\Repository\Calidad\InsumoArticuloRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  7. /**
  8.  * @ORM\Entity(repositoryClass=InsumoArticuloRepository::class)
  9.  * @UniqueEntity(
  10.  *     fields={"nombre"},
  11.  *     errorPath="nombre",
  12.  *     message="Ya existe un insumo con el nombre ingresado"
  13.  * )
  14.  */
  15. class InsumoArticulo
  16. {
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue
  20.      * @ORM\Column(type="integer")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @ORM\Column(type="string", length=255)
  25.      * @Assert\NotNull(message="El campo es requerido")
  26.      */
  27.     private $nombre;
  28.     /**
  29.      * @ORM\Column(type="boolean")
  30.      */
  31.     private $activo true;
  32.     public function __toString()
  33.     {
  34.         return $this->nombre;
  35.     }
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getNombre(): ?string
  41.     {
  42.         return $this->nombre;
  43.     }
  44.     public function setNombre(string $nombre): self
  45.     {
  46.         $this->nombre $nombre;
  47.         return $this;
  48.     }
  49.     public function isActivo(): ?bool
  50.     {
  51.         return $this->activo;
  52.     }
  53.     public function setActivo(bool $activo): self
  54.     {
  55.         $this->activo $activo;
  56.         return $this;
  57.     }
  58. }