Marca o atendimento como erro de triagem. E gera um novo atendimento para
o servico informado.

@param Novosga\Request $request

@Route("/redirecionar", name="novosga_attendance_redirecionar", methods={"POST"})
358673
public function redirecionar(
        Request $request,
        AtendimentoService $atendimentoService,
        TranslatorInterface $translator
    ) {
        $envelope = new Envelope();
        $data     = json_decode($request->getContent());

        $usuario     = $this->getUser();
        $unidade     = $usuario->getLotacao()->getUnidade();
        $servico     = (int) $data->servico;
        $novoUsuario = null;
        $atual       = $atendimentoService->atendimentoAndamento($usuario->getId(), $unidade);

        if (!$atual) {
            throw new Exception(
                $translator->trans('error.attendance.not_in_process', [], self::DOMAIN)
            );
        }
        
        if (isset($data->usuario)) {
            $novoUsuario = $this
                ->getDoctrine()
                ->getManager()
                ->getRepository(Usuario::class)
                ->find($data->usuario);
        }

        $redirecionado = $atendimentoService->redirecionar($atual, $unidade, $servico, $novoUsuario);
        if (!$redirecionado->getId()) {
            throw new Exception(
                $translator->trans(
                    'error.attendance.redirect',
                    [
                        '%atendimento%' => $atual->getId(),
                        '%servico%'     => $servico,
                    ],
                    self::DOMAIN
                )
            );
        }

        return $this->json($envelope);
    }
193703
public function store(Request $request)
    {
        $this->validate($request, Role::$rules, Role::$messages);

        $this->createEntry(Role::class, $request->all());

        return redirect_to_resource();
    }
1355013
public function cancelRedirectAction(Request $request)
    {
        $orderReference = $request->query->get('orderReference');
        $urlHmac = $request->query->get('sig');

        if ($orderReference) {
            $cancelRedirectTransfer = new PayoneCancelRedirectTransfer();
            $cancelRedirectTransfer->setOrderReference($orderReference);
            $cancelRedirectTransfer->setUrlHmac($urlHmac);

            $response = $this->getClient()->cancelRedirect($cancelRedirectTransfer);
        }

        return $this->redirectResponseInternal(PayoneControllerProvider::CHECKOUT_PAYMENT);
    }
778884
public function redirect(Request $request)
    {
        $provider = $request->get('provider');

        if ($provider === null) {
            throw new HttpException(500, 'provider necessary');
        }

        return \Socialize::with($provider)->redirect();
    }
715650
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        $details = ArrayObject::ensureArrayObject($request->getModel());

        if ($this->api instanceof EcpayLogisticsApi && empty($details['GoodsAmount']) === true) {
            $params = $this->api->createCvsMapTransaction((array) $details);
            $endpoint = $this->api->getApiEndpoint();

            throw new HttpPostRedirect(
                $endpoint, $params
            );
        }

        $params = $this->api->createTransaction((array) $details);

        if (isset($params['RtnCode']) === true ||
            isset($params['ResCode']) === true ||
            isset($params['RtnMerchantTradeNo']) === true && isset($params['RtnOrderNo']) === true ||
            isset($params['CVSStoreID']) === true ||
            isset($params['ErrorMessage']) === true
        ) {
            $details->replace($params);
        } else {
            $endpoint = $this->api->getApiEndpoint();

            throw new HttpPostRedirect(
                $endpoint, $params
            );
        }
    }
85067
protected function logout(Request $request)
    {
        impersonate()->logout();

        // if redirect url in request
        if ($request->has('redirect_to')) {
            return redirect($request->get('redirect_to'));
        }

        return back();
    }
306396
public function deleteAction(Request $request, SakonninTemplate $sakonninTemplate)
    {
        $form = $this->createDeleteForm($sakonninTemplate);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrineManager();
            $em->remove($sakonninTemplate);
            $em->flush();
        }

        return $this->redirectToRoute('sakonnintemplate_index');
    }
163199
public function store(Request $request)
	{
		$this->authorize('blog',  Auth::user());
	
		$this->validate($request, Evento::storeRules());
		$id = \DB::transaction(function () use ($request){
			$evento = Evento::create(Evento::storeAttributes($request));

			return $evento->id;
		});
		
		return redirect(route('evento.edit', $id));
	}
126160
protected function dispatchCurrentPageEvent(Request $request)
    {
        $pageName = $request->get('page');
        $seo = $this->seoRepository->fromPermalink($pageName);
        if (null !== $seo) {
            $page = $this->pageRepository->fromPk($seo->getPageId());
            $pageName = $page->getPageName();
        }

        $eventName = sprintf('page_renderer.before_%s_rendering', $pageName);
        $this->dispatcher->dispatch($eventName, $this->event);
    }
1115865
public function newAction(Request $request)
    {
        $redirection = new Redirection();

        $form = $this->getRedirectionForm($redirection, '#new-redirection-form-container');
        $form->handleRequest($request);

        if ($request->query->get('novalidate', false) === false) {
            if ($form->isValid()) {
                if ($redirection->getLink()->getLinkType() !== Link::TYPE_NONE) {
                    $em = $this->getDoctrine()->getManager();
                    $em->persist($redirection);
                    $em->flush();

                    $this->congrat($this->get('translator')->trans('victoire.redirection.create.success'));

                    return new Response($this->renderView('@VictoireSeo/Redirection/_newForm.html.twig', [
                        'isOpened'  => true,
                        'form'      => $this->getRedirectionForm(new Redirection(), '#new-redirection-form-container')->createView(),
                        'icTrigger' => [
                            'target' => '#redirections-list-container',
                            'url'    => $this->generateUrl('victoire_redirection_showListItem', [
                                'id' => $redirection->getId(),
                            ]),
                        ],
                    ]), 200, [
                        'X-Inject-Alertify' => true,
                    ]);
                } else {
                    // force form error when no link submitted
                    $form->addError(new FormError('This value should not be blank.'));
                }
            } else {
                $this->warn($this->get('translator')->trans('victoire.404.form.error.unvalid'));
            }

            return new Response($this->renderView('@VictoireSeo/Redirection/_newForm.html.twig', [
                'form'     => $form->createView(),
                'isOpened' => true,
            ]), 200, [
                'X-Inject-Alertify' => true,
            ]);
        }

        // rebuild form to avoid wrong form error
        $form = $this->getRedirectionForm($redirection, '#new-redirection-form-container');

        return new JsonResponse([
            'html' => $this->renderView('@VictoireSeo/Redirection/_newForm.html.twig', [
                'form'      => $form->createView(),
                'isOpened'  => true,
            ]),
        ]);
    }
559881
public function createAction(Request $request)
    {
        $newTag = new Tag();
        $newTagForm = $this->createForm(new TagType(),$newTag);

        $newTagForm->handleRequest($request);

        if($newTagForm->isValid())
        {
            $em = $this->getDoctrine()->getManager();
            $em->persist($newTag);
            $em->flush();
        }

        return $this->redirect($this->generateUrl('tag'));
    }
1156183
protected function sendFailedLoginResponse(Request $request)
    {
        return redirect()->back()
            ->withInput($request->only($this->username(), 'remember'))
            ->withErrors([
                $this->username() => Lang::get('auth.failed'),
            ]);
    }
1192515
public function addAction(Request $request): Response
    {
        $form = $this->formFactory->addCustomUrl();
        $form->handleRequest($request);

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

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (CustomUrlAddData $data) {
                $this->urlAliasService->createUrlAlias(
                    $data->getLocation(),
                    $data->getPath(),
                    $data->getLanguage()->languageCode,
                    $data->isRedirect()
                );

                return $this->redirectToLocation($data->getLocation(), UrlsTab::URI_FRAGMENT);
            });

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

        if ($location) {
            return $this->redirectToLocation($location, UrlsTab::URI_FRAGMENT);
        }

        return $this->redirectToRoute('ezplatform.dashboard');
    }
576126
public function handleRequest(Request $request): void
    {
        $this->getForm()->handleRequest($request);
        $this->handleForm($request->get('page'));
    }
1099923
public function store(Request $request)
    {
        $name = \Transliteration::clean_filename(strtolower($request->label));
        $label = $request->label;

        try
        {
            WorkflowState::create([
                            'name' => $name,
                            'label' => $label,
                ]);
        }
        catch(\Illuminate\Database\QueryException $e){
            // do what you want here with $e->getMessage();
            return redirect()->route('state')->with('message', 'Error');
        }

        return redirect()->route('state')->with('message', 'Add data success');
    }
1188769
public function insertCustom(Request $request)
    {
        $validation = Validator::make($request->all(), [
            'name'  => 'required|unique:menus,name',
            'title' => 'required'
        ]);
        if ($validation->fails()) {
            return redirect()->back()->withInput()->withErrors($validation);
        }
        // Create controller
        $controllerBuilder = new ControllerBuilder();
        $controllerBuilder->buildCustom($request->name);

        // Create views
        $viewsBuilder = new ViewsBuilder();
        $viewsBuilder->buildCustom($request->name);

        $menu = Menu::create([
            'position'  => 0,
            'menu_type' => 3,
            'icon'      => $request->icon != '' ? $request->icon : 'fa-database',
            'name'      => $request->name,
            'title'     => $request->title,
            'parent_id' => $request->parent_id ?: null,
        ]);
        $menu->roles()->sync($request->input('roles', []));

        return redirect()->route('menu');
    }
137701
public function searchAction(Request $request)
    {
        $this->get('session')->remove('language_search_session');

        if ($request->getMethod() === Request::METHOD_POST) {

            $form = $this->createForm(new LanguageFormType(),new Language(),array(
                'search' => true,
            ));

            $form->handleRequest($request);

            $this->get('session')->set('language_search_session',serialize($form->getData()));
        }

        return $this->redirect($this->generateUrl('admin_language'));
    }