Example #1
0
 /**
  * Create a new user from a response
  *
  * @param UserResponseInterface $response
  *
  * @return UserInterface
  */
 protected function createUser(UserResponseInterface $response)
 {
     /**
      * @var CustomerInterface $customer
      */
     $customer = $this->customerDirector->create();
     $customer->setEmail($response->getEmail())->setFirstname($response->getRealName());
     $this->customerDirector->save($customer);
     $this->userEventDispatcher->dispatchOnCustomerRegisteredEvent($customer);
     return $customer;
 }
Example #2
0
 /**
  * Register new User into the web.
  * Creates new token given a user, with related Role set.
  *
  * @param AbstractUserInterface $user User to register
  *
  * @return $this Self object
  */
 public function register(AbstractUserInterface $user)
 {
     $this->userEventDispatcher->dispatchOnUserRegisteredEvent($user);
     return $this;
 }