Welches Event oder welche Art von Hook ist hier möglich?

Mhh, ich habe folgendes Problem: Im Core gibt es im folgende öffentliche Methode im Checkout Controller:

    public function calculateShippingCostsAction()
    {
        if ($this->Request()->getPost('sCountry')) {
            $this->session['sCountry'] = (int) $this->Request()->getPost('sCountry');
            $this->session['sState'] = 0;
            $this->session['sArea'] = Shopware()->Db()->fetchOne('
            SELECT areaID FROM s_core_countries WHERE id = ?
            ', [$this->session['sCountry']]);
        }

        if ($this->Request()->getPost('sPayment')) {
            $this->session['sPaymentID'] = (int) $this->Request()->getPost('sPayment');
        }

        if ($this->Request()->getPost('sDispatch')) {
            $this->session['sDispatch'] = (int) $this->Request()->getPost('sDispatch');
        }

        if ($this->Request()->getPost('sState')) {
            $this->session['sState'] = (int) $this->Request()->getPost('sState');
        }

        // We might change the shop context here so we need to initialize it again
        $this->get('shopware_storefront.context_service')->initializeShopContext();

        // We need an indicator in the view to expand the shipping costs pre-calculation on page load
        $this->View()->assign('calculateShippingCosts', true);
        
        $this->forward($this->Request()->getParam('sTargetAction', 'index'));
    }

Ich muss nun eine Möglichkeit finden Code (session_write_close() im Speziellen) zwischen

        $this->View()->assign('calculateShippingCosts', true);
        
        // session_write_close() here

        $this->forward($this->Request()->getParam('sTargetAction', 'index'));

diesen beiden Zeilen ausführen ODER das $this->forward(…) abzubrechen, damit ich in einem PostDispatch-Event die session schreiben kann und danach das forward selbst mache.

Mhh, so scheint es glaube ich zu funktionieren?

    // pre event
    // 'Enlight_Controller_Action_Frontend_Checkout_calculateShippingCosts'
    // => 'onFrontendCheckoutCalculateShippingCosts',



    public function onFrontendCheckoutCalculateShippingCosts(\Enlight_Event_EventArgs $args) {
        // make sure to write session to db on cart ajax shipping costs calculation
        $controller = $args->getSubject();
        $request = $controller->Request();                
        if ($request->isPost() && $request->getParam('sTargetAction', '') == 'cart') {
            $args->setProcessed(true);            
            $controller->calculateShippingCostsAction();
            session_write_close();            
            Shopware()->Modules()->Admin()->sUpdatePayment();
            $controller->forward('cart');            
        }
    }