44 lines
1.3 KiB
PHP
44 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\BusProNet\Model;
|
|
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
/**
|
|
* Represents communication information including email and phone numbers.
|
|
*
|
|
* This class handles contact information for users and participants in the booking system.
|
|
* It provides validation constraints for required fields and methods to convert
|
|
* communication data to API payload format.
|
|
*/
|
|
class Communication
|
|
{
|
|
public ?string $phone = null;
|
|
|
|
#[Assert\NotBlank(message: 'Bitte angeben', groups: ['personal_data'])]
|
|
public ?string $mobile = null;
|
|
|
|
#[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 = null;
|
|
|
|
/**
|
|
* Converts the communication data to API payload format.
|
|
*
|
|
* Transforms the communication object into an array structure suitable
|
|
* for API communication with the BusProNet system.
|
|
*
|
|
* @return array<string, string> The payload array for API transmission
|
|
*/
|
|
public function toPayload(): array
|
|
{
|
|
return [
|
|
'email' => $this->email,
|
|
'telefonmobil' => $this->mobile,
|
|
'telefonprivat' => $this->phone,
|
|
];
|
|
}
|
|
}
|