Восстановление из корзины.

@param Request $request

@return RedirectResponse|Response
168448
public function untrashAction(Request $request)
    {
        /** @var AbstractAdmin $admin */
        $admin = $this->getAdmin();

        $admin->checkAccess('undelete');

        /** @var \Sonata\DoctrineORMAdminBundle\Model\ModelManager $modelManager */
        $modelManager = $admin->getModelManager();

        /** @var EntityManager $em */
        $em = $modelManager->getEntityManager($admin->getClass());

        $filters = $em->getFilters();

        if ($admin->getParent()) {
            $filters->enable('softdeleteable');
            $filters->enable('softdeleteabletrash');

            /** @var SoftDeleteableFilter $softdeleteable */
            $softdeleteable = $filters->getFilter('softdeleteable');

            /** @var SoftDeleteableTrashFilter $softdeleteabletrash */
            $softdeleteabletrash = $filters->getFilter('softdeleteabletrash');

            $parentEntityClass = $admin->getParent()->getClass();

            $softdeleteable->enableForEntity($parentEntityClass);
            $softdeleteabletrash->disableForEntity($parentEntityClass);

            $softdeleteable->disableForEntity($admin->getClass());
        } elseif ($filters->isEnabled('softdeleteable')) {
            $filters->disable('softdeleteable');
            $filters->enable('softdeleteabletrash');
        }

        $id = $request->get($admin->getIdParameter());
        $object = $admin->getObject($id);

        if (!$object) {
            throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
        }

        if ('POST' === $request->getMethod()) {
            // check the csrf token
            $this->validateCsrfToken('sonata.untrash');

            $translator = $this->get('translator');

            try {
                $object->setDeletedAt(null);
                $admin->update($object);

                if ($this->isXmlHttpRequest()) {
                    return $this->renderJson(['result' => 'ok']);
                }

                $this->addFlash('sonata_flash_info', $translator->trans('flash_untrash_successfull', []));
            } catch (\Exception $e) {
                if ($this->isXmlHttpRequest()) {
                    return $this->renderJson(['result' => 'error']);
                }

                $this->addFlash('sonata_flash_info', $translator->trans('flash_untrash_error', []));
            }

            return new RedirectResponse($admin->generateUrl('list'));
        }

        return $this->renderWithExtraParams('@CompoSonataAdmin/CRUD/untrash.html.twig', [
            'object' => $object,
            'action' => 'untrash',
            'csrf_token' => $this->getCsrfToken('sonata.untrash'),
        ]);
    }
1106717
public function registerAction(Request $request)
    {
        if ($this->isGranted(AuthenticatedVoter::IS_AUTHENTICATED_REMEMBERED)) {
            return $this->redirectToRoute($this->getParameter('darvin_user.already_logged_in_redirect_route'));
        }

        $widget = $request->isXmlHttpRequest();

        $form = $this->getSecurityFormFactory()->createRegistrationForm()->handleRequest($request);

        if (!$form->isSubmitted()) {
            return new Response($this->getSecurityFormRenderer()->renderRegistrationForm($widget, $form));
        }

        $successMessage = 'security.action.register.success';

        $needConfirm = $this->getParameter('darvin_user.confirm_registration');
        if (!$this->getSecurityFormHandler()->handleRegistrationForm($form, !$widget, $successMessage, $needConfirm)) {
            $html = $this->getSecurityFormRenderer()->renderRegistrationForm($widget, $form);

            return $widget
                ? new AjaxResponse($html, false, FlashNotifierInterface::MESSAGE_FORM_ERROR)
                : new Response($html);
        }

        $url = $needConfirm ?
            $this->generateUrl('darvin_user_security_confirm_registration') :
            $this->generateUrl($this->getParameter('darvin_user.already_logged_in_redirect_route'))
        ;

        return $widget
            ? new AjaxResponse('', true, $successMessage, [], $url)
            : $this->redirect($url);
    }
889255
public function authentication(Request $request)
    {
        try {
            $this->authRepositoryInterface->authenticate($request->all());
        } catch (FormValidationException $e) {
            Flash::error($e->getMessage());

            return redirect()
              ->route('auth.login')
              ->withErrors($e->getErrors());
        } catch (AuthenticationException $e) {
            Flash::error($e->getMessage());

            return redirect()->route('auth.login');
        }

        return redirect()->route('dashboard.index');
    }
986719
public function run(Request $request) {
		$page = $this->getServiceContainer()->getKernel()->getApplication()->getPage();
		$page->setTitle($this->getServiceContainer()->getTranslator()->trans('sessions'));

		if ($request->isMethod('POST')) {
			$post = $request->request;
			if ($post->has('token')) {
				SessionQuery::create()->findOneByToken($post->get('token'))->delete();
				$service = $this->getServiceContainer();
				$accountUrl = $service->getPreferenceLoader()->getSystemPreferences()->getAccountUrl();
				$translator = $service->getTranslator();
				$url = sprintf('%s%s/%s',
					$accountUrl,
					$translator->trans('slug.settings'),
					$translator->trans('slug.settings.sessions')
				);
				return new RedirectResponse($url);
			}
		}

		return $this->responder->run($request);
	}
408457
public function resend(Request $request)
    {
        if ($request->user()->hasVerifiedEmail()) {
            return redirect($this->redirectPath());
        }

        $request->user()->sendEmailVerificationNotification();

        return back()->with('resent', true);
    }
874128
protected function doRequest(Request $request)
    {

        $this->client->send($request, $response = new Response());

        return $response;
    }
115982
public function store(Request $request)
    {
        $attributes = request()->validate(News::$rules, News::$messages);

        $news = $this->createEntry(News::class, $attributes);

        return redirect_to_resource();
    }
968561
public function addAction(Request $request): Response
    {
        $form = $this->formFactory->addTranslation();
        $form->handleRequest($request);

        /** @var TranslationAddData $data */
        $data = $form->getData();
        $location = $data->getLocation();

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (TranslationAddData $data) {
                $location = $data->getLocation();
                $contentInfo = $location->getContentInfo();
                $language = $data->getLanguage();
                $baseLanguage = $data->getBaseLanguage();

                return new RedirectResponse($this->generateUrl('ezplatform.content.translate', [
                    'contentId' => $contentInfo->id,
                    'fromLanguageCode' => null !== $baseLanguage ? $baseLanguage->languageCode : null,
                    'toLanguageCode' => $language->languageCode,
                ]));
            });

            if ($result instanceof Response) {
                return $result;
            }
        }

        $redirectionUrl = null !== $location
            ? $this->generateUrl('_ezpublishLocation', ['locationId' => $location->id])
            : $this->generateUrl('ezplatform.dashboard');

        return $this->redirect($redirectionUrl);
    }
663505
public function postRegister(Request $request)
	{
		$validator = $this->registrar->validator($request->all());

		if ($validator->fails())
		{
			$this->throwValidationException(
				$request, $validator
			);
		}

		$this->auth->login($this->registrar->create($request->all()));

		return redirect($this->redirectPath());
	}
208064
public function redirectAction(Request $request, $id)
    {
        $locale = $this->getRequestParameter($request, 'locale', true);
        $format = $this->getRequestParameter($request, 'format');

        /** @var Media $media */
        $media = $this->container->get('sulu_media.media_manager')->getById($id, $locale);

        if (null === $format) {
            return $this->redirect($media->getUrl());
        }

        if (!array_key_exists($format, $media->getFormats())) {
            throw $this->createNotFoundException();
        }

        return $this->redirect($media->getFormats()[$format]);
    }
180838
protected function redirectAfterContentChange(Request $request)
    {
        if (null !== $referer = $request->headers->get('referer', null)) {
            return $this->redirect($referer);
        }

        return $this->redirect($this->generateUrl('ekyna_cart_index'));
    }
1160138
public function getOAuthAction(Request $request)
    {
        $this->initSession($request);

        $hash = md5(join("_", $request->request->all()) . uniqid());
        $this->sessionBag->set("hash", $hash);

        return $this->redirect(
            $this->getOAuthUrl($this->getCallbackUrl($request), $this->getClientId(), $hash),
            302,
            $this->defaultResponseHeaders
        );
    }
763116
public function run(Request $request) {
		$prefs = $this->getServiceContainer()->getPreferenceLoader()->getSystemPreferences();
		$auth = $this->getServiceContainer()->getAuthManager();
		$auth->logout();
		return new RedirectResponse($prefs->getAccountUrl());
	}
709929
public function store(Request $request)
	{
		$this->validate($request, Tag::$rules, Tag::$messages);

        $row = $this->createEntry(Tag::class, $request->only('name'));

        return redirect_to_resource();
	}
1028032
public function postRemind(Request $request)
    {

        $form = FormBuilder::create('Distilleries\Expendable\Http\Forms\Login\Forgotten');
        if ($form->hasError())
        {
            return $form->validateAndRedirectBack();
        }

        $this->validate($request, ['email' => 'required|email']);
        
        $response = $this->broker()->sendResetLink($request->only('email'));

        switch ($response)
        {
            case \Password::RESET_LINK_SENT:
                return redirect()->back()->with(Message::MESSAGE, [trans($response)]);
            default:
                return redirect()->back()->with(Message::WARNING, [trans($response)]);
        }

    }
55342
public function store(Request $request)
    {
        $request = $this->processRequest($request);

        if ($request === true) {
            return $this->redirection();
        }

        $this->validate($request, $this->model->rules());

        $this->model = $this->model->create($request->all());

        $saved = $this->afterSaving($request);

        if ($saved) {
            return $this->redirection();
        }
    }
352123
public function handle(Request $request)
	{
		$response = $this->next($request);

		if ($content = $response->original)
		{
			$content = $this->traverse($request, $content);

			$response->setContent($content);
		}

		return $response;
	}