diff --git a/Classes/Profile/ProfileFactory.php b/Classes/Profile/ProfileFactory.php index 22b7ef2..cee9671 100644 --- a/Classes/Profile/ProfileFactory.php +++ b/Classes/Profile/ProfileFactory.php @@ -24,7 +24,10 @@ final class ProfileFactory extends AbstractProfileFactory */ protected function createProfileFromFrontendUser(array $frontendUserData): Profile { + $pid = (int)$frontendUserData['pid']; + $profile = new Profile(); + $profile->setPid($pid); $profile->setTitle((string)($frontendUserData['title'] ?? '')); $profile->setFirstName((string)($frontendUserData['first_name'] ?? '')); $profile->setMiddleName((string)($frontendUserData['middle_name'] ?? '')); @@ -32,9 +35,11 @@ protected function createProfileFromFrontendUser(array $frontendUserData): Profi $profile->setWebsite((string)($frontendUserData['www'] ?? '')); $contract = new Contract(); + $contract->setPid($pid); $profile->getContracts()->attach($contract); $address = new Address(); + $address->setPid($pid); $address->setStreet((string)($frontendUserData['address'] ?? '')); $address->setZip((string)($frontendUserData['zip'] ?? '')); $address->setCity((string)($frontendUserData['city'] ?? '')); @@ -43,18 +48,21 @@ protected function createProfileFromFrontendUser(array $frontendUserData): Profi if (!empty($frontendUserData['email'])) { $email = new Email(); + $email->setPid($pid); $email->setEmail((string)($frontendUserData['email'])); $contract->getEmailAddresses()->attach($email); } if (!empty($frontendUserData['telephone'])) { $phoneNumber = new PhoneNumber(); + $phoneNumber->setPid($pid); $phoneNumber->setPhoneNumber((string)($frontendUserData['telephone'])); $phoneNumber->setType('phone'); $contract->getPhoneNumbers()->attach($phoneNumber); } if (!empty($frontendUserData['fax'])) { $phoneNumber = new PhoneNumber(); + $phoneNumber->setPid($pid); $phoneNumber->setPhoneNumber((string)($frontendUserData['fax'])); $phoneNumber->setType('fax'); $contract->getPhoneNumbers()->attach($phoneNumber);