WIP: Implement crm selections
This commit is contained in:
@@ -55,4 +55,25 @@ class CrmAttributesResponse
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
$crmSelections = [];
|
||||
|
||||
foreach ($this->getAttributeGroups() as $group) {
|
||||
/** @var CrmAttributeGroup $group */
|
||||
if (false === isset($crmSelections[$group->getLabel()])) {
|
||||
$crmSelections[$group->getLabel()] = [];
|
||||
}
|
||||
foreach ($group->getAttributes() as $attribute) {
|
||||
/** @var CrmAttribute $attribute */
|
||||
if (false === $attribute->isSelected()) {
|
||||
continue;
|
||||
}
|
||||
$crmSelections[$group->getLabel()][] = $attribute->getLabel();
|
||||
}
|
||||
}
|
||||
|
||||
return $crmSelections;
|
||||
}
|
||||
}
|
||||
@@ -48,8 +48,12 @@ class UserDataHandler
|
||||
]);
|
||||
}
|
||||
|
||||
public function createLocalUser(ProfileResponse $profileResponse, array $roles, bool $isTeamer = false): User
|
||||
{
|
||||
public function createLocalUser(
|
||||
ProfileResponse $profileResponse,
|
||||
array $roles,
|
||||
bool $isTeamer = false,
|
||||
array $crmSelections = []
|
||||
): User {
|
||||
$user = new User();
|
||||
$user
|
||||
->setFirstName($profileResponse->getFirstName())
|
||||
@@ -62,6 +66,7 @@ class UserDataHandler
|
||||
|
||||
if (true === $isTeamer) {
|
||||
$teamer = Teamer::fromApiResponse($profileResponse);
|
||||
$teamer->setCrmSelections($crmSelections);
|
||||
$user->setTeamer($teamer);
|
||||
$this->logger->info('Create teamer', [
|
||||
'uuid' => $teamer->getUuid(),
|
||||
@@ -82,7 +87,8 @@ class UserDataHandler
|
||||
User $user,
|
||||
ProfileResponse $profileResponse,
|
||||
array $roles,
|
||||
bool $isTeamer = false
|
||||
bool $isTeamer = false,
|
||||
array $crmSelections = []
|
||||
): void {
|
||||
$user->setRoles($roles);
|
||||
|
||||
@@ -93,6 +99,7 @@ class UserDataHandler
|
||||
->getTeamer()
|
||||
->setAddress($address)
|
||||
->setCommunication($communication)
|
||||
->setCrmSelections($crmSelections)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user