feat: better data wf
This commit is contained in:
59
src/Entity/Input/QRCode/QRCodeMoney.php
Normal file
59
src/Entity/Input/QRCode/QRCodeMoney.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Entity\Input\QRCode;
|
||||
|
||||
use App\Validator\Currency;
|
||||
use App\Validator\Money;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* Money type for QR code
|
||||
*/
|
||||
class QRCodeMoney
|
||||
{
|
||||
#[Assert\Positive(
|
||||
message: 'messages.not_valid_amount',
|
||||
)]
|
||||
#[Assert\NotBlank(message: 'messages.fill_value')]
|
||||
#[Money(message: 'messages.not_valid_amount')]
|
||||
private ?string $amount;
|
||||
|
||||
// TODO: getCurrencies validation
|
||||
#[Assert\NotBlank(message: 'messages.fill_value')]
|
||||
#[Currency(message: 'messages.not_currency')]
|
||||
private ?string $currency;
|
||||
|
||||
/**
|
||||
* @param string|null $amount
|
||||
* @param string|null $currency
|
||||
*/
|
||||
public function __construct(?string $amount = null, ?string $currency = null)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
$this->currency = $currency;
|
||||
}
|
||||
|
||||
|
||||
public function getAmount(): ?string
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
public function setAmount(?string $amount): void
|
||||
{
|
||||
$this->amount = $amount;
|
||||
}
|
||||
|
||||
public function getCurrency(): ?string
|
||||
{
|
||||
return $this->currency;
|
||||
}
|
||||
|
||||
public function setCurrency(?string $currency): void
|
||||
{
|
||||
$this->currency = $currency;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user