feat: improved validation of personal data

This commit is contained in:
Björn Fromme committed 2025-04-11 08:29:06 +02:00
1 parent 011fe9c5c4
commit 9c1aa60782
5 files changed
+53 -27

No files matched your search

+12 -4
View File
@@ -2,11 +2,19 @@
namespace App\BusProNet\Model;
use Symfony\Component\Validator\Constraints as Assert;
class Communication
{
public ?string $phone = null;
public ?string $mobile = null;
public ?string $email = null;
public ?string $phone = '';
#[Assert\NotBlank(message: 'Bitte angeben', groups: ['personal_data'])]
public ?string $mobile = '';
#[Assert\NotBlank(message: 'Bitte angeben', groups: ['personal_data'])]
#[Assert\Email(message: 'Bitte eine gültige Adresse angeben', mode: 'strict', groups: ['personal_data'])]
public ?string $email = '';
public bool $newsletter = false;
public function toPayload(): array
@@ -18,4 +26,4 @@ class Communication
'newsletter' => $this->newsletter ? 'True' : 'False',
];
}
}
}