setActionName 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',
                        
$request = clone $request;
    $response = clone $response;

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

    if (isset($params['module'])) {
        $request->setModuleName($params['module'])
                ->setControllerName('index')
                ->setActionName('index');
    }
    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');
    
$error->offsetSet('exception', $exception);

        // 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) {
            
            $response->setStatusCode(SymfonyResponse::HTTP_CREATED);
        } elseif ($method === 'DELETE' && $id === false) {
            $action = 'batchDelete';
            $response->setStatusCode(SymfonyResponse::HTTP_OK);
        } elseif ($method === 'DELETE') {
            $response->setStatusCode(SymfonyResponse::HTTP_OK);
            $action = 'delete';
        }

        if ($action === 'invalid') {
            $request->setControllerName('index');
            $request->setActionName($action);

            return;
        }

        if (!$subType) {
            $request->setActionName($action);

            return;
        }

        if ($action === 'get' && $subId === false) {
            

    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 */
    
/** * Returns the action method of the given request class. * If no action name is set in the request class, the default action is used. * * @return string */
    public function getActionMethod(Enlight_Controller_Request_Request $request)
    {
        $action = $request->getActionName();
        if (empty($action)) {
            $action = $this->getDefaultAction();
            $request->setActionName($action);
        }
        $formatted = $this->formatActionName($action);

        return strtolower($formatted[0]) . substr($formatted, 1) . 'Action';
    }

    /** * Returns the full path of the controller name by the given request class. * To generate the full controller path the module and controller name must be set in the given request object. * The module and controller path is imploded by '_' * * @return string */
if ($request->getModuleName() !== 'api') {
            return;
        }

        /** @var Shopware_Components_Auth $auth */
        $auth = $this->get('auth');
        $result = $auth->authenticate();

        if (!$result->isValid()) {
            $request->setControllerName('error');
            $request->setActionName('noauth');

            return;
        }

        $identity = $result->getIdentity();

        $db = $this->get('db');
        $select = $db->select()
                     ->from('s_core_auth')
                     ->where('username LIKE ?', $identity['username']);

        
private function buildActionSequence(FlowSequenceEntity $parent, bool $trueCase = true): FlowSequenceEntity
    {
        $actions = $this->getActions();

        $sequence = FlowSequenceEntity::createFrom($parent);

        /** @var FlowActionDefinition $action */
        $action = $this->faker->randomElement($actions);
        $sequence->setId(Uuid::randomHex());

        $sequence->setParentId($parent->getId());
        $sequence->setActionName($action->getName());
        $sequence->setConfig($this->generateActionConfig($action->getName()));
        $sequence->setTrueCase($trueCase);
        $sequence->setPosition($parent->getPosition() + 1);

        if ($parent->getActionName()) {
            $sequence->assign([
                'parentId' => $parent->getParentId(),
                'trueCase' => $parent->isTrueCase(),
            ]);
        }

        
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 */
    
Home | Imprint | This part of the site doesn't use cookies.