Note: changes to the user's account will not be committed for persistence. Please use addRoleToAccount(), removeRoleFromAccount(),
setRolesForAccount() and setUserPassword() for changing account properties.
public updateUser ( |
||
$user | The modified user | |
return | void |
/** * Update/adds a user preference * * @param string $key The key of the preference to update/add * @param string $value The value of the preference * @return void */ public function updateAction($key, $value) { // TODO: This should be done in an earlier stage (TypeConverter ?) if (strtolower($value) === 'false') { $value = false; } elseif (strtolower($value) === 'true') { $value = true; } $user = $this->userService->getCurrentUser(); $user->getPreferences()->set($key, $value); $this->userService->updateUser($user); $this->throwStatus(204, 'User preferences have been updated'); }
/** * Delete an electronic address action * * @param User $user * @param ElectronicAddress $electronicAddress * @return void */ public function deleteElectronicAddressAction(User $user, ElectronicAddress $electronicAddress) { $user->removeElectronicAddress($electronicAddress); $this->userService->updateUser($user); $this->addFlashMessage('The electronic address "%s" (%s) has been deleted for "%s".', 'Electronic address removed', Message::SEVERITY_NOTICE, array(htmlspecialchars($electronicAddress->getIdentifier()), htmlspecialchars($electronicAddress->getType()), htmlspecialchars($user->getName())), 1412374678); $this->redirect('edit', null, null, array('user' => $user)); }