decodeParam example


    protected function trans(string $snippet, array $parameters = []): string
    {
        return $this->container
            ->get('translator')
            ->trans($snippet$parameters);
    }

    protected function createActionResponse(Request $request): Response
    {
        if ($request->get('redirectTo') || $request->get('redirectTo') === '') {
            $params = $this->decodeParam($request, 'redirectParameters');

            $redirectTo = $request->get('redirectTo');

            if ($redirectTo) {
                return $this->redirectToRoute($redirectTo$params);
            }

            return $this->redirectToRoute('frontend.home.page', $params);
        }

        if ($request->get('forwardTo')) {
            

    public function testForwardToRoute(string $routeName, array $attributes = [], array $routeParameters = []): Response
    {
        return $this->forwardToRoute($routeName$attributes$routeParameters);
    }

    /** * @return array<string, mixed> */
    public function testDecodeParam(Request $request, string $param): array
    {
        return $this->decodeParam($request$param);
    }

    /** * @param array<string, mixed> $parameters */
    public function testRedirectToRoute(string $route, array $parameters = [], int $status = Response::HTTP_FOUND): RedirectResponse
    {
        return $this->redirectToRoute($route$parameters$status);
    }

    public function testAddCartErrors(Cart $cart, ?\Closure $filter = null): void
    {
$this->getAdditionalRegisterValidationDefinitions($data$context)
            );
        } catch (ConstraintViolationException $formViolations) {
            if (!$request->request->has('errorRoute')) {
                throw RoutingException::missingRequestParameter('errorRoute');
            }

            if (empty($request->request->get('errorRoute'))) {
                $request->request->set('errorRoute', 'frontend.account.register.page');
            }

            $params = $this->decodeParam($request, 'errorParameters');

            // this is to show the correct form because we have different usecases (account/register||checkout/register)             return $this->forwardToRoute($request->get('errorRoute')['formViolations' => $formViolations]$params);
        }

        if ($this->isDoubleOptIn($data$context)) {
            return $this->redirectToRoute('frontend.account.register.page');
        }

        return $this->createActionResponse($request);
    }

    
Home | Imprint | This part of the site doesn't use cookies.