ensureRequest example

$now = isset($now) ? $now : (new DateTime())->format('Y-m-d H:i:s');

            $added = $voteConfirmed ? $this->front->getParam('optinDate') : $now;
            $doubleOptInConfirmed = $voteConfirmed ? $now : null;
            $mailDataExists = $this->connection->fetchColumn(
                'SELECT 1 FROM s_campaigns_maildata WHERE email = ? AND groupID = ?',
                [
                    $email,
                    $groupID,
                ]
            );
            $request = $this->front->ensureRequest();

            if (empty($mailDataExists)) {
                $sql = ' REPLACE INTO s_campaigns_maildata ( email, groupID, salutation, title, firstname, lastname, street, zipcode, city, added, double_optin_confirmed ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ';
                $this->connection->executeQuery($sql[
                    $email,
                    


        $voteConfirmed = false;

        $hash = $this->Request()->getParam('sConfirmation');
        if ($hash) {
            $getVote = $this->container->get('db')->fetchRow(
                'SELECT * FROM s_core_optin WHERE hash = ?',
                [$hash]
            );
            if (!empty($getVote['data'])) {
                $this->container->get('front')->ensureRequest()->setPost(unserialize($getVote['data']['allowed_classes' => false]));
                $voteConfirmed = true;
                $this->container->get('db')->query('DELETE FROM s_core_optin WHERE hash = ?', [$hash]);
            }
        }

        if (empty($this->container->get('front')->ensureRequest()->getPost('sVoteSummary'))) {
            $sErrorFlag['sVoteSummary'] = true;
        }

        if (!$voteConfirmed) {
            $captchaValidator = $this->container->get('shopware.captcha.validator');

            

        $this->eventManager->notify(
            'Enlight_Controller_Front_RouteStartup',
            $eventArgs
        );

        /* * Route request to controller/action, if a router is provided */
        try {
            $this->ensureRouter()->route($this->ensureRequest());
        } catch (Exception $e) {
            if ($this->throwExceptions()) {
                throw $e;
            }
            $this->Response()->setException($e);
        }

        /* * Notify plugins of router completion */
        $this->eventManager->notify(
            

        if ($this->Request()->isPost()) {
            if (!$this->Request()->getParam('sAddPremium')) {
                $this->session->offsetSet(
                    'sErrorMessages',
                    $this->container->get('snippets')->getNamespace('frontend')->get(
                        'CheckoutSelectPremiumVariant',
                        'Please select an option to place the required premium to the cart'
                    )
                );
            } else {
                $this->front->ensureRequest()->setQuery('sAddPremium', $this->Request()->getParam('sAddPremium'));
                $this->basket->sInsertPremium();
            }
        }
        $this->redirect([
            'controller' => $this->Request()->getParam('sTarget', 'checkout'),
            'action' => $this->Request()->getParam('sTargetAction', 'index'),
        ]);
    }

    /** * On any change on country, payment or dispatch recalculate shipping costs * and forward to cart / confirm view * * @return void */
Home | Imprint | This part of the site doesn't use cookies.