89 lines
2.0 KiB
PHP
89 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Entity\Traits\BlameableEntity;
|
|
use App\Entity\Traits\SoftDeletableEntity;
|
|
use App\Entity\Traits\TimestampableEntity;
|
|
use App\Repository\FeeRepository;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
#[ORM\Entity(repositoryClass: FeeRepository::class)]
|
|
class Fee implements BlameableEntityInterface, TimestampableEntityInterface, SoftDeletableEntityInterface
|
|
{
|
|
use BlameableEntity;
|
|
use TimestampableEntity;
|
|
use SoftDeletableEntity;
|
|
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\Column]
|
|
#[Assert\NotNull(message: 'Bitte gib den Wert an')]
|
|
private ?int $value = null; // Stored as int, divide by 100!
|
|
|
|
#[ORM\Column(length: 255)]
|
|
#[Assert\NotBlank(message: 'Bitte gib die Bezeichnung an')]
|
|
private ?string $name = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
#[Assert\NotBlank(message: 'Bitte gib die interne Bezeichnung an')]
|
|
private ?string $nameInternal = null;
|
|
|
|
public static function duplicate(Fee $fee): static
|
|
{
|
|
$instance = new static();
|
|
$instance
|
|
->setName($fee->getName())
|
|
->setNameInternal($fee->getNameInternal())
|
|
->setValue($fee->getValue())
|
|
;
|
|
|
|
return $instance;
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getValue(): ?int
|
|
{
|
|
return $this->value;
|
|
}
|
|
|
|
public function setValue(int $value): static
|
|
{
|
|
$this->value = $value;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getName(): ?string
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
public function setName(string $name): static
|
|
{
|
|
$this->name = $name;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getNameInternal(): ?string
|
|
{
|
|
return $this->nameInternal;
|
|
}
|
|
|
|
public function setNameInternal(?string $nameInternal): static
|
|
{
|
|
$this->nameInternal = $nameInternal;
|
|
|
|
return $this;
|
|
}
|
|
}
|