/** * {@inheritdoc} */ protected function onSuccess(User $user) { $this->manager->updateUser($user); if ($this->form->has('inviteUser') && $this->form->has('plainPassword') && $this->form->get('inviteUser')->getViewData() && $this->form->get('plainPassword')->getViewData()) { try { $this->sendInviteMail($user, $this->form->get('plainPassword')->getViewData()['first']); } catch (\Exception $ex) { $this->logger->error('Invitation email sending failed.', ['exception' => $ex]); $this->flashBag->add('warning', $this->translator->trans('oro.user.controller.invite.fail.message')); } } // Reloads the user to reset its username. This is needed when the // username or password have been changed to avoid issues with the // security layer. // Additional checking for userConfigManager !== null is added because of API // to avoid "Call to a member function on a non-object". $this->manager->reloadUser($user); if ($this->form->has('signature') && $this->userConfigManager !== null) { $signature = $this->form->get('signature')->getData(); if ($signature) { $this->userConfigManager->set('oro_email.signature', $signature); } else { $this->userConfigManager->reset('oro_email.signature'); } $this->userConfigManager->flush(); } }
public function testReset() { $name = 'testName.testValue'; $this->userScopeManager->expects($this->once())->method('reset')->with($name); $this->manager->reset($name); }