src/Entity/Mantenimiento/SectorPlanta.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Mantenimiento;
  3. use App\Repository\Mantenimiento\SectorPlantaRepository;
  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=SectorPlantaRepository::class)
  9.  * @ORM\Table(name="mant_sector_planta")
  10.  * @UniqueEntity(
  11.  *     fields={"nombre"},
  12.  *     errorPath="nombre",
  13.  *     message="Ya existe un sector con el nombre ingresado"
  14.  * )
  15.  */
  16. class SectorPlanta
  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 $active true;
  33.     public function __toString()
  34.     {
  35.         return strtoupper($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 isActive(): ?bool
  51.     {
  52.         return $this->active;
  53.     }
  54.     public function setActive(bool $active): self
  55.     {
  56.         $this->active $active;
  57.         return $this;
  58.     }
  59. }