Skip to content

Instantly share code, notes, and snippets.

@skurfuerst
Created May 5, 2011 09:16
Show Gist options
  • Save skurfuerst/956774 to your computer and use it in GitHub Desktop.
Save skurfuerst/956774 to your computer and use it in GitHub Desktop.
$account = new \F3\FLOW3\Security\Account();
$account->setAccountIdentifier($accountJson->username);
$person = new Person();
$firstnameAndLastname = explode(' ', $accountJson->name, 2);
$firstName = '';
$lastName = '';
if (isset($firstnameAndLastname[0])) {
$firstName = $firstnameAndLastname[0];
}
if (isset($firstnameAndLastname[1])) {
$lastName = $firstnameAndLastname[1];
}
$person->setName(new PersonName('', $firstName, $lastName));
$electronicAddress = new ElectronicAddress();
$electronicAddress->setIdentifier($accountJson->email);
$electronicAddress->setType(ElectronicAddress::TYPE_EMAIL);
$electronicAddress->setUsage(ElectronicAddress::USAGE_WORK);
$person->setPrimaryElectronicAddress($electronicAddress);
$account->setParty($person);
$this->accountRepository->add($account);
@kdambekalns
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment