setDispatched example

$url = $args->getRequest()->getPathInfo();
                $url = trim($url, '/');

                foreach (explode('/', $url) as $part) {
                    $part = explode(',', $part);
                    if (!empty($part[0]) && !empty($part[1])) {
                        $request->setParam($part[0]$part[1]);
                    }
                }

                if ($request->getParam('sAction') && $request->getParam('sAction') === 'doSale') {
                    $request->setControllerName('checkout')->setActionName('finish')->setDispatched(false);
                } else {
                    $request->setControllerName('checkout')->setActionName('confirm')->setDispatched(false);
                }
                break;
            case 'cat':
                $request->setControllerName('listing')->setDispatched(false);
                break;
            case 'supplier':
                $url = $args->getSubject()->Router()->assemble([
                        'controller' => 'listing',
                        'action' => 'manufacturer',
                        
$this->eventManager->notify(
            'Enlight_Controller_Front_DispatchLoopStartup',
            $eventArgs
        );

        /* * Attempts to dispatch the controller/action. If the $this->request * indicates that it needs to be dispatched, it moves to the next * action in the request. */
        do {
            $this->ensureRequest()->setDispatched();

            /* * Notify plugins of dispatch startup */
            try {
                $this->eventManager->notify(
                    'Enlight_Controller_Front_PreDispatch',
                    $eventArgs
                );

                /* * Skip requested action if preDispatch() has reset it */

    protected function initServiceMode($request)
    {
        $config = $this->get(Shopware_Components_Config::class);
        if (!empty($config->get('setOffline'))
            && !str_contains($config->get('offlineIp')$request->getClientIp())
            && $request->getControllerName() !== 'error'
        ) {
            $request->setControllerName('error')->setActionName('service')->setDispatched(false);
        }
    }

    /** * @deprecated - Will be private with Shopware 5.8 * * @param Request $request * @param Enlight_Controller_Response_ResponseHttp $response * * @return void */
    
if ($controller instanceof ContainerAwareInterface) {
            $container = Shopware()->Container();
            $controller->setContainer($container);
        }

        $controller->initController($request$response);

        $controller->setFront($this->Front());

        $action = $this->getActionMethod($request);

        $request->setDispatched(true);

        $disableOb = $this->Front()->getParam('disableOutputBuffering');
        $obLevel = ob_get_level();
        if (empty($disableOb)) {
            ob_start();
        }

        try {
            $controller->dispatch($action);
        } catch (Exception $e) {
            $curObLevel = ob_get_level();
            
if ($params !== null) {
            $request->setParams($params);
        }
        if ($controller !== null) {
            $request->setControllerName($controller);
            if ($module !== null) {
                $request->setModuleName($module);
            }
        }

        $request->setActionName($action)->setDispatched(false);
    }

    /** * Redirect the request. The frontend router will assemble the url. * * @param string|array $url * * @throws Exception * * @return void */
    
if ($front->Request() === null) {
            $front->setRequest($enlightRequest);
            $response = $front->dispatch();
        } else {
            $dispatcher = clone $front->Dispatcher();
            $response = clone $front->Response();

            $response->clearHeaders()
                ->clearBody();

            $response->setStatusCode(SymfonyResponse::HTTP_OK);
            $enlightRequest->setDispatched();
            $dispatcher->dispatch($enlightRequest$response);
        }

        $response->prepare($request);

        return $response;
    }

    /** * @return EnlightRequest */
    
if (isset($params['controller'])) {
        $request->setControllerName($params['controller'])
                ->setActionName('index');
    }

    // setParam is used for bc reasons, the attribute should be read for new code     $request->setParam('_isSubrequest', true);
    $request->setAttribute('_isSubrequest', true);

    $request->setActionName(isset($params['action']) ? $params['action'] : 'index');
    $request->setParams($params)
            ->setDispatched(true);

    Shopware()->Container()->get('request_stack')->push($request);

    $dispatcher->dispatch($request$response);

    if (!$request->isDispatched() || $response->isRedirect()) {
        // forwards and redirects render nothing         return '';
    }

    $return = $response->getBody();

    
// Keep a copy of the original request         $error->offsetSet('request', clone $request);

        // Get a count of the number of exceptions encountered         $this->exceptionCountAtFirstEncounter = \count($exceptions);

        // Forward to the error handler         $request->setParam('error_handler', $error)
            ->setControllerName('error')
            ->setActionName('error')
            ->setDispatched(false);
    }

    private function isBotSession(ShopwareRequest $request): bool
    {
        if (!$request instanceof SymfonyRequest) {
            return false;
        }

        $session = $request->getSession();
        if (!$session instanceof SessionInterface) {
            return false;
        }
Home | Imprint | This part of the site doesn't use cookies.