Removes all preferences for specific user. This is usually used when removing the user.
public deletePreferences ( |
||
$user | The user to delete the preference for |
/** * Returns an item to delete. * * @param Request $request * @param string|int $id * * @throws NotFoundHttpException * @throws RuntimeException * @throws UserProtectedException * * @return mixed */ public function __invoke(Request $request, $id) { list($resourceType) = $this->extractAttributes($request); /** * @var User */ $item = $this->getItem($this->dataProvider, $resourceType, $id); if ($item->isProtected()) { throw new UserProtectedException(); } $this->userService->deleteFOSUser($item); $this->userPreferenceService->deletePreferences($item); return $item; }