/** * Processes the form for a given request. * * @param Request $request Active request * @param Form $form Form to process * @param UserResponseInterface $userInformation OAuth response * * @return boolean True if the processing was successful */ public function process(Request $request, Form $form, UserResponseInterface $userInformation) { $formHandler = $this->reconstructFormHandler($request, $form); // make FOSUB process the form already $processed = $formHandler->process(); // if the form is not posted we'll try to set some properties if ('POST' !== $request->getMethod()) { $user = $form->getData(); $user->setUsername($this->getUniqueUsername($userInformation->getDisplayName())); if ($userInformation instanceof AdvancedUserResponseInterface) { $user->setEmail($userInformation->getEmail()); } $form->setData($user); } return $processed; }