<?php
namespace App\Entity\Almacen;
use App\Repository\Almacen\CategoriaRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass=CategoriaRepository::class)
* @ORM\Table(name="gral_categoria_articulo")
* @UniqueEntity(
* fields={"nombre"},
* errorPath="nombre",
* message="Ya existe una categoria con el nombre ingresado"
* )
*/
class Categoria
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Assert\NotNull(message="El campo es requerido")
*/
private $nombre;
/**
* @ORM\Column(type="boolean")
*/
private $activo = true;
public function __toString()
{
return $this->nombre;
}
public function getId(): ?int
{
return $this->id;
}
public function getNombre(): ?string
{
return $this->nombre;
}
public function setNombre(string $nombre): self
{
$this->nombre = $nombre;
return $this;
}
public function isActivo(): ?bool
{
return $this->activo;
}
public function setActivo(bool $activo): self
{
$this->activo = $activo;
return $this;
}
}