src/Entity/JogosRegras.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\JogosRegrasRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassJogosRegrasRepository::class)]
  9. class JogosRegras
  10. {
  11.     const TP_REGRAS = [
  12.         'Ajuda' => 'ajuda',
  13.         'Método' => 'metodo',
  14.     ];
  15.     
  16.     #[ORM\Id]
  17.     #[ORM\GeneratedValue]
  18.     #[ORM\Column]
  19.     private ?int $id null;
  20.     #[ORM\Column(length255)]
  21.     private ?string $nome null;
  22.     #[ORM\Column]
  23.     private ?bool $ativo null;
  24.     #[ORM\OneToMany(mappedBy'JogosRegras'targetEntityJogosParametros::class)]
  25.     private Collection $JogosParametros;
  26.     #[ORM\Column(length255)]
  27.     private ?string $parametro null;
  28.     #[ORM\Column(length3nullabletrue)]
  29.     private ?string $acao null;
  30.     #[ORM\Column(length10)]
  31.     private ?string $tpRegra null;
  32.     public function __construct()
  33.     {
  34.         $this->JogosParametros = new ArrayCollection();
  35.     }
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getNome(): ?string
  41.     {
  42.         return $this->nome;
  43.     }
  44.     public function setNome(string $nome): self
  45.     {
  46.         $this->nome $nome;
  47.         return $this;
  48.     }
  49.     public function isAtivo(): ?bool
  50.     {
  51.         return $this->ativo;
  52.     }
  53.     public function setAtivo(bool $ativo): self
  54.     {
  55.         $this->ativo $ativo;
  56.         return $this;
  57.     }
  58.     /**
  59.      * @return Collection<int, JogosParametros>
  60.      */
  61.     public function getJogosParametros(): Collection
  62.     {
  63.         return $this->JogosParametros;
  64.     }
  65.     public function addJogosParametro(JogosParametros $jogosParametro): self
  66.     {
  67.         if (!$this->JogosParametros->contains($jogosParametro)) {
  68.             $this->JogosParametros->add($jogosParametro);
  69.             $jogosParametro->setJogosRegras($this);
  70.         }
  71.         return $this;
  72.     }
  73.     public function removeJogosParametro(JogosParametros $jogosParametro): self
  74.     {
  75.         if ($this->JogosParametros->removeElement($jogosParametro)) {
  76.             // set the owning side to null (unless already changed)
  77.             if ($jogosParametro->getJogosRegras() === $this) {
  78.                 $jogosParametro->setJogosRegras(null);
  79.             }
  80.         }
  81.         return $this;
  82.     }
  83.     public function getParametro(): ?string
  84.     {
  85.         return $this->parametro;
  86.     }
  87.     public function setParametro(string $parametro): self
  88.     {
  89.         $this->parametro $parametro;
  90.         return $this;
  91.     }
  92.     public function getAcao(): ?string
  93.     {
  94.         return $this->acao;
  95.     }
  96.     public function setAcao(?string $acao): self
  97.     {
  98.         $this->acao $acao;
  99.         return $this;
  100.     }
  101.     public function getTpRegra(): ?string
  102.     {
  103.         return $this->tpRegra;
  104.     }
  105.     public function setTpRegra(string $tpRegra): static
  106.     {
  107.         $this->tpRegra $tpRegra;
  108.         return $this;
  109.     }
  110.     
  111.     public function getTpRegraDesc(): ?string
  112.     {
  113.         $r '';
  114.         foreach(JogosRegras::TP_REGRAS as $key => $label){
  115.             if($label == $this->tpRegra){
  116.                 $r $key;
  117.             }
  118.         }
  119.         return $r;
  120.     }
  121. }