src/Entity/Creditos.php line 9
<?phpnamespace App\Entity;use App\Repository\CreditosRepository;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: CreditosRepository::class)]class Creditos{const TP_COMPRA_CREDITOS = 0;const TP_PREMIO = 1;const TP_BONUS = 2;const TP_DIVERSOS = 3;const TP_CADASTRO = 4;const TP_DESCONTO = 5;const TP_CONFIG_INFO = 6;const VET_TP = [self::TP_COMPRA_CREDITOS => ['label' => 'Compra de créditos', 'img' => '/img/tesouro.gif', 'qtd' => 1500, 'sinal' => '+'],self::TP_PREMIO => ['label' => 'Prêmio', 'img' => '/img/rubi.gif', 'qtd' => 20, 'sinal' => '+'],self::TP_BONUS => ['label' => 'Bônus', 'img' => '/img/estrela.gif', 'qtd' => 10, 'sinal' => '+'],self::TP_DIVERSOS => ['label' => 'Diversos', 'img' => '/img/moeda.gif', 'qtd' => 1, 'sinal' => '+'],self::TP_CADASTRO => ['label' => 'Cadastro', 'img' => '/img/moeda.gif', 'qtd' => 50, 'sinal' => '+'],self::TP_DESCONTO => ['label' => 'Desconto', 'img' => '/img/moeda.gif', 'qtd' => 1, 'sinal' => '-'],self::TP_CONFIG_INFO => ['label' => 'Configurações', 'img' => '/img/moeda.gif', 'qtd' => 100, 'sinal' => '+'],];#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?string $nome = null;#[ORM\Column]private ?float $valor = null;#[ORM\Column]private ?int $tipo = null;#[ORM\Column]private ?\DateTimeImmutable $created_at = null;#[ORM\ManyToOne(inversedBy: 'Creditos')]private ?User $User = null;public function getId(): ?int{return $this->id;}public function getNome(): ?string{return $this->nome;}public function setNome(string $nome): self{$this->nome = $nome;return $this;}public function getValor(): ?float{return $this->valor;}public function setValor(float $valor): self{$this->valor = $valor;return $this;}public function getTipo(): ?int{return $this->tipo;}public function getTipoLabel(){return self::VET_TP[$this->tipo]['label'];}public function getTipoImg(){return self::VET_TP[$this->tipo]['img'];}public function getTipoSinal(){return self::VET_TP[$this->tipo]['sinal'];}public function setTipo(int $tipo): self{$this->tipo = $tipo;if(!isset(self::VET_TP[$tipo])){throw new \Exception('Tipo de crédito não encontrado');}return $this;}public function getCreatedAt(): ?\DateTimeImmutable{return $this->created_at;}public function setCreatedAt(): self{$this->created_at = new \DateTimeImmutable('now');return $this;}public function getUser(): ?User{return $this->User;}public function setUser(?User $User): self{$this->User = $User;return $this;}}