if ($data->
get('accountType'
)) { $customer['accountType'
] =
$data->
get('accountType'
);
} if ($data->
get('accountType'
) === CustomerEntity::ACCOUNT_TYPE_BUSINESS && !
empty($billingAddress['company'
])) { $customer['company'
] =
$billingAddress['company'
];
if ($data->
get('vatIds'
)) { $customer['vatIds'
] =
$data->
get('vatIds'
);
} } $customer =
$this->
addDoubleOptInData($customer,
$context);
$customer['boundSalesChannelId'
] =
$this->
getBoundSalesChannelId($customer['email'
],
$context);
if ($data->
get('customFields'
) instanceof RequestDataBag
) { $customer['customFields'
] =
$this->customFieldMapper->
map(CustomerDefinition::ENTITY_NAME,
$data->
get('customFields'
));
} $this->customerRepository->
create([$customer],
$context->
getContext());
$criteria =
new Criteria([$customer['id'
]]);
$criteria->
addAssociation('addresses'
);