src/Entity/Almacen/Categoria.php line 19

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