clearBody example

/** @var \Shopware_Plugins_Core_HttpCache_Bootstrap $httpCache */
    $httpCache = Shopware()->Plugins()->Core()->HttpCache();
    if ($esiTag = $httpCache->renderEsiTag($request$params)) {
        return $esiTag;
    }

    $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');
    }

    
$this->View()->assign([
                'success' => false,
                'message' => 'Could not create mail object.',
            ]);

            return;
        }

        $mail->clearRecipients();
        $mail->clearSubject();
        $mail->clearFrom();
        $mail->clearBody();

        $mailData = [
            'attachments' => $attachments,
            'subject' => $this->Request()->getParam('subject', ''),
            'fromMail' => $this->Request()->getParam('fromMail'),
            'fromName' => $this->Request()->getParam('fromName'),
            'to' => [$this->Request()->getParam('to')],
            'isHtml' => $this->Request()->getParam('isHtml'),
            'bodyHtml' => $this->Request()->getParam('contentHtml', ''),
            'bodyText' => $this->Request()->getParam('content', ''),
        ];

        
$enlightRequest = $this->transformSymfonyRequestToEnlightRequest($request);

        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;
    }

    
Home | Imprint | This part of the site doesn't use cookies.