feat: improved mutability checks for personal data in edit or create mode

This commit is contained in:
Björn Fromme
2025-10-28 15:34:09 +01:00
parent 51dbf20118
commit 5021f414d1
27 changed files with 435 additions and 233 deletions
-6
View File
@@ -4,8 +4,6 @@ declare(strict_types=1);
namespace App\BusProNet\Model;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Represents a physical address with street, postal code, city, and country information.
*
@@ -15,18 +13,14 @@ use Symfony\Component\Validator\Constraints as Assert;
*/
class Address
{
#[Assert\NotBlank(message: 'Bitte angeben', groups: ['personal_data', 'applicant_address'])]
public ?string $street = null;
#[Assert\NotBlank(message: 'Bitte angeben', groups: ['personal_data', 'applicant_address'])]
public ?string $postCode = null;
#[Assert\NotBlank(message: 'Bitte angeben', groups: ['personal_data', 'applicant_address'])]
public ?string $city = null;
public ?string $district = null;
#[Assert\NotBlank(message: 'Bitte angeben', groups: ['personal_data', 'applicant_address'])]
public ?string $country = null;
/**
+22
View File
@@ -16,6 +16,15 @@ use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
*/
class Insurance
{
/**
* Special ID for the synthetic "no insurance" option.
*
* This option is injected into the insurance selection list to force explicit user choice
* for legal compliance. When selected, it satisfies validation requirements but transmits
* no insurance data to the BPN API.
*/
public const NO_INSURANCE_ID = '0';
#[Groups(['api:single', 'api:list'])]
public ?string $id = null;
@@ -180,4 +189,17 @@ class Insurance
return array_values(array_unique($urls));
}
/**
* Checks if this is the synthetic "no insurance" option.
*
* The "no insurance" option is a UI construct used to force explicit user choice.
* It should be excluded from BPN API transmission.
*
* @return bool True if this is the "no insurance" option
*/
public function isNoInsurance(): bool
{
return self::NO_INSURANCE_ID === $this->id;
}
}