fix: don't rely on communication properties being present
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\BusProNet\DataProcessor;
|
namespace App\BusProNet\DataProcessor;
|
||||||
|
|
||||||
|
use App\BusProNet\Model\Communication;
|
||||||
use App\Form\Model\BookingData;
|
use App\Form\Model\BookingData;
|
||||||
|
|
||||||
class BookingDataProcessor
|
class BookingDataProcessor
|
||||||
@@ -88,8 +89,14 @@ class BookingDataProcessor
|
|||||||
$bookingData->participants[$participant->index]->height = $participant->height;
|
$bookingData->participants[$participant->index]->height = $participant->height;
|
||||||
$bookingData->participants[$participant->index]->weight = $participant->weight;
|
$bookingData->participants[$participant->index]->weight = $participant->weight;
|
||||||
$bookingData->participants[$participant->index]->shoeSize = $participant->shoeSize;
|
$bookingData->participants[$participant->index]->shoeSize = $participant->shoeSize;
|
||||||
$bookingData->participants[$participant->index]->communication->email = $participant->email;
|
|
||||||
$bookingData->participants[$participant->index]->communication->mobile = $participant->mobile;
|
if ($participant->email || $participant->mobile) {
|
||||||
|
if (null === $bookingData->participants[$participant->index]->communication) {
|
||||||
|
$bookingData->participants[$participant->index]->communication = new Communication();
|
||||||
|
}
|
||||||
|
$bookingData->participants[$participant->index]->communication->email = $participant->email;
|
||||||
|
$bookingData->participants[$participant->index]->communication->mobile = $participant->mobile;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update applicant's data with personal data of first participant
|
// Update applicant's data with personal data of first participant
|
||||||
|
|||||||
@@ -96,8 +96,8 @@ class ParticipantData
|
|||||||
$instance->lastName = $personalData->name;
|
$instance->lastName = $personalData->name;
|
||||||
$instance->gender = $personalData->gender;
|
$instance->gender = $personalData->gender;
|
||||||
$instance->nationality = $personalData->nationality;
|
$instance->nationality = $personalData->nationality;
|
||||||
$instance->email = $personalData->communication->email;
|
$instance->email = $personalData->communication?->email;
|
||||||
$instance->mobile = $personalData->communication->mobile;
|
$instance->mobile = $personalData->communication?->mobile;
|
||||||
$instance->dateOfBirth = $personalData->dateOfBirth;
|
$instance->dateOfBirth = $personalData->dateOfBirth;
|
||||||
$instance->height = $personalData->height;
|
$instance->height = $personalData->height;
|
||||||
$instance->weight = $personalData->weight;
|
$instance->weight = $personalData->weight;
|
||||||
|
|||||||
Reference in New Issue
Block a user