typo3 удалить данные сеанса fe-user

Привет, у меня есть расширение typo3, которое хранит данные в сеансе.

После завершения моих действий я хочу удалить данные сеанса.

Я пробовал это:

$GLOBALS['TSFE']->fe_user->removeSessionData();

Но это не работает.

В чем моя неудача? заранее спасибо

ОБНОВЛЕНИЕ

        if ( is_null($GLOBALS["TSFE"]->fe_user->getKey("ses", "Step1")) ) {
            $this->redirect('noProductFound');
        }

        $arguments = $this->request->getArguments();
        $reloadPage = new \TYPO3\ShopExtension\Controller\ShopStep();
        $product = $arguments['product'];

        $orderProcessed = $GLOBALS['TSFE']->fe_user->getKey('ses', 'orderProcessed');

        #Verhindern das Seite neu geladen wird und eine neue Bestellung getätigt wird.
        if ($reloadPage->getReload() == true | $orderProcessed == true) {
            $this->redirect('noProductFound', null, null, array('error' => 'orderProcessed'));
        } else {
            if ($product == ShopConstant::AG_TRIAL) {
                $this->save_Product_Trial();
                $reloadPage->setReload(true);
                $GLOBALS['TSFE']->fe_user->setKey('ses', 'orderProcessed', true);
                $GLOBALS['TSFE']->storeSessionData();
            } elseif ($product == ShopConstant::AG_PROFESSIONELL || $product == ShopConstant::AG_PREMIUM || $product == ShopConstant::AG_ULTIMATE) {
                $afterOrderOrderId = $this->save_Product_Auditgarant($product);
                $reloadPage->setReload(true);
                $GLOBALS['TSFE']->fe_user->setKey('ses', 'orderProcessed', true);
                $GLOBALS['TSFE']->storeSessionData();
            } elseif ($product == ShopConstant::BOOK_AL || $product == ShopConstant::BOOK_PH || $product == ShopConstant::BOOK_CPMS || $product == ShopConstant::BOOK_USABILITY) {
                $this->save_Product_Book($product);
                $reloadPage->setReload(true);
                $GLOBALS['TSFE']->fe_user->setKey('ses', 'orderProcessed', true);
                $GLOBALS['TSFE']->storeSessionData();
            } elseif ($product == ShopConstant::INSTITUTSTAG || $product == ShopConstant::INSTITUTSTAG_PARTNER || $product == ShopConstant::INSTITUTSTAG_ALUMNI) {
                $this->save_Product_Institutstag($product);
                $reloadPage->setReload(true);
                $GLOBALS['TSFE']->fe_user->setKey('ses', 'orderProcessed', true);
                $GLOBALS['TSFE']->storeSessionData();
            } else {
                $this->redirect('noProductFound');
            }
            #Session löschen, da Daten ab hier nicht mehr benötigt werden.
            $GLOBALS['TSFE']->fe_user->removeSessionData();
            $GLOBALS['TSFE']->fe_user->setKey('ses', 'Step1', null);
            $GLOBALS['TSFE']->storeSessionData();
//            \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($GLOBALS['TSFE']);
//            exit();
            #Führt einen redirect durch mit angehängtem Attribut des letzten Step.
            $this->redirect('getContent', null, null, array(
                'step' => $arguments['lastStep'],
                'shopStep' => $arguments['product'],
                'afterOrderOrderId' => $afterOrderOrderId
            ));

person Felix    schedule 23.03.2018    source источник


Ответы (1)


Если вы сделали $GLOBALS['TSFE']->fe_user->setAndSaveSessionData('session_key', $somevalue);, вы можете просто сделать $GLOBALS['TSFE']->fe_user->setAndSaveSessionData('session_key', null);, чтобы удалить данные сеанса.

person Euli    schedule 23.03.2018
comment
пробовал, но безрезультатно. когда я перезагружаю страницу, данные все еще присутствуют. тоже пробовал это $GLOBALS['TSFE']->fe_user->setKey('ses', 'Step1', null); $GLOBALS['TSFE']->storeSessionData(); - person Felix; 23.03.2018
comment
Мне нужно больше вашего кода, чтобы воспроизвести вашу проблему. - person Euli; 23.03.2018
comment
любые дополнительные намеки? - person Felix; 06.04.2018
comment
@Felix, не могли бы вы проверить, какое значение содержит ваш сеанс, когда вы проверяете его в своем первом операторе if? Упомянутые решения должны работать. - person Euli; 29.06.2018