<?php
declare(strict_types=1);
namespace App\Shop\Doctrine\Entity;
use App\Shop\Doctrine\Repository\VatRepository;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\Table;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\Validator\Constraints\NotBlank;
#[Entity(repositoryClass: VatRepository::class)]
#[Table(name: '`shop_vat`')]
class Vat
{
#[Id]
#[Column(type: 'integer')]
#[GeneratedValue]
private ?int $id = null;
#[Column]
#[NotBlank]
private string $name;
#[Column(type: 'float', precision: 5, scale: 4)]
#[NotBlank]
private float $rate;
public function __get(string $name): mixed
{
$propertyAccessor = PropertyAccess::createPropertyAccessor();
return $propertyAccessor->getValue($this, $name);
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): string
{
return $this->name;
}
public function setName(string $name): void
{
$this->name = $name;
}
public function getRate(): float
{
return $this->rate;
}
public function setRate(float $rate): void
{
$this->rate = $rate;
}
}