src/Entity/SecFuncion.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SecFuncionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassSecFuncionRepository::class)]
  8. class SecFuncion
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length100)]
  15.     private ?string $nombre null;
  16.     #[ORM\Column(length100nullabletrue)]
  17.     private ?string $icono null;
  18.     #[ORM\Column(length100nullabletrue)]
  19.     private ?string $class null;
  20.     #[ORM\Column]
  21.     private ?int $orden null;
  22.     #[ORM\Column(length100)]
  23.     private ?string $endpoint null;
  24.     #[ORM\ManyToOne(inversedBy'secFuncion')]
  25.     private ?SecModulo $modulo null;
  26.     #[ORM\OneToMany(mappedBy'funcion'targetEntitySecAccion::class)]
  27.     private Collection $secAccion;
  28.     #[ORM\Column]
  29.     private ?bool $subFuncion null;
  30.     #[ORM\Column(nullabletrue)]
  31.     private ?int $funcionPadre null;
  32.     #[ORM\Column(length300nullabletrue)]
  33.     private ?string $repository null;
  34.     #[ORM\Column(nullabletrue)]
  35.     private ?int $tipo null;
  36.     /**
  37.      * Controla si la función aparece en la gestión de roles/permisos.
  38.      * Solo las funciones con mostrar=true son asignables a roles desde el formulario.
  39.      * Las funciones paramétricas, RF, Comercial, etc. quedan en false.
  40.      */
  41.     #[ORM\Column(type'boolean'options: ['default' => false])]
  42.     private bool $mostrar false;
  43.     public function __construct()
  44.     {
  45.         $this->modulo = new ArrayCollection();
  46.         $this->secAccion = new ArrayCollection();
  47.     }
  48.     public function getId(): ?int
  49.     {
  50.         return $this->id;
  51.     }
  52.     public function getNombre(): ?string
  53.     {
  54.         return $this->nombre;
  55.     }
  56.     public function setNombre(string $nombre): static
  57.     {
  58.         $this->nombre $nombre;
  59.         return $this;
  60.     }
  61.     public function getIcono(): ?string
  62.     {
  63.         return $this->icono;
  64.     }
  65.     public function setIcono(?string $icono): static
  66.     {
  67.         $this->icono $icono;
  68.         return $this;
  69.     }
  70.     public function getClass(): ?string
  71.     {
  72.         return $this->class;
  73.     }
  74.     public function setClass(?string $class): static
  75.     {
  76.         $this->class $class;
  77.         return $this;
  78.     }
  79.     public function getOrden(): ?int
  80.     {
  81.         return $this->orden;
  82.     }
  83.     public function setOrden(int $orden): static
  84.     {
  85.         $this->orden $orden;
  86.         return $this;
  87.     }
  88.     public function getEndpoint(): ?string
  89.     {
  90.         return $this->endpoint;
  91.     }
  92.     public function setEndpoint(string $endpoint): static
  93.     {
  94.         $this->endpoint $endpoint;
  95.         return $this;
  96.     }
  97.     public function getModulo(): ?SecModulo
  98.     {
  99.         return $this->modulo;
  100.     }
  101.     public function setModulo(?SecModulo $modulo): static
  102.     {
  103.         $this->modulo $modulo;
  104.         return $this;
  105.     }
  106.     /**
  107.      * @return Collection<int, SecAccion>
  108.      */
  109.     public function getSecAccion(): Collection
  110.     {
  111.         return $this->secAccion;
  112.     }
  113.     public function addSecAccion(SecAccion $secAccion): static
  114.     {
  115.         if (!$this->secAccion->contains($secAccion)) {
  116.             $this->secAccion->add($secAccion);
  117.             $secAccion->setFuncion($this);
  118.         }
  119.         return $this;
  120.     }
  121.     public function removeSecAccion(SecAccion $secAccion): static
  122.     {
  123.         if ($this->secAccion->removeElement($secAccion)) {
  124.             // set the owning side to null (unless already changed)
  125.             if ($secAccion->getFuncion() === $this) {
  126.                 $secAccion->setFuncion(null);
  127.             }
  128.         }
  129.         return $this;
  130.     }
  131.     public function isSubFuncion(): ?bool
  132.     {
  133.         return $this->subFuncion;
  134.     }
  135.     public function setSubFuncion(bool $subFuncion): static
  136.     {
  137.         $this->subFuncion $subFuncion;
  138.         return $this;
  139.     }
  140.     public function getFuncionPadre(): ?int
  141.     {
  142.         return $this->funcionPadre;
  143.     }
  144.     public function setFuncionPadre(?int $funcionPadre): static
  145.     {
  146.         $this->funcionPadre $funcionPadre;
  147.         return $this;
  148.     }
  149.     public function getRepository(): ?string
  150.     {
  151.         return $this->repository;
  152.     }
  153.     public function setRepository(?string $repository): static
  154.     {
  155.         $this->repository $repository;
  156.         return $this;
  157.     }
  158.     public function getTipo(): ?int
  159.     {
  160.         return $this->tipo;
  161.     }
  162.     public function setTipo(?int $tipo): static
  163.     {
  164.         $this->tipo $tipo;
  165.         return $this;
  166.     }
  167.     /**
  168.      * Indica si la función es visible en la gestión de roles/permisos.
  169.      */
  170.     public function isMostrar(): bool
  171.     {
  172.         return $this->mostrar;
  173.     }
  174.     /**
  175.      * Define si la función aparece en el formulario de asignación de permisos.
  176.      * Solo los módulos de producción activos deberían tener mostrar=true.
  177.      */
  178.     public function setMostrar(bool $mostrar): static
  179.     {
  180.         $this->mostrar $mostrar;
  181.         return $this;
  182.     }
  183. }