Project

General

Profile

Actions

Bug #92867

closed

Standaloneview not working in Eid request handler

Added by Karel Kuijpers over 3 years ago. Updated about 1 year ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2020-11-18
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

Description

I am using an Eid requesthandler to process Ajax calls from a page. i am using Standaloneview to return html to the Ajax call. This works fine in typo3 9.5. But after upgrade to 10.4 I got at the moment of instantiation of TYPO3\CMS\Fluid\View\StandaloneView the error:
(1/1) #1538370377 LogicException
TypoScriptFrontendController was tried to be injected before initial creation


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #93646: ContentObjectRenderer gets resetted when using FluidEmailNew2021-03-04

Actions
Actions #1

Updated by Oliver Hader over 3 years ago

StandaloneView uses ContentObjectRender ("cObj") e.g. to have stdWrap functionality in place.
In case you're not using page-related or TypoScript-related functionality, switching to TemplateView seems to be the better alternative.

Actions #2

Updated by Oliver Hader over 3 years ago

  • Status changed from New to Needs Feedback
Actions #3

Updated by Karel Kuijpers over 3 years ago

TemplateView is more or less workable. The problem is that as soon as I use f:translate in my template the view can't be rendered. I have tried with key="LLL:EXT:myext/Resources/Private/Language/locallang.xlf:key1" but it does not help.

Actions #4

Updated by Karel Kuijpers over 3 years ago

I managed to get TemplateView working by calling it this way:
$this->objectManager=GeneralUtility::makeInstance(ObjectManager::class);
$context = $this->objectManager->get(RenderingContext::class, $this);
$request = $this->objectManager->get(WebRequest::class);
$request->setRequestUri(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'));
$request->setBaseUri(GeneralUtility::getIndpEnv('TYPO3_SITE_URL'));
$request->setControllerExtensionName('extensionname');
$controllerContext = $this->objectManager->get(ControllerContext::class);
$controllerContext->setRequest($request);
$uriBuilder = $this->objectManager->get(UriBuilder::class);
$uriBuilder->setRequest($request);
$controllerContext->setUriBuilder($uriBuilder);
$context->setControllerContext($controllerContext);

$this->view=GeneralUtility::makeInstance(TemplateView::class);
$this->view->setRenderingContext($context);

In fact I copied most of the code of the __construct of StandaloneView. So I made more or less the 9.5 version of StandaloneView. I don't know it this is the intention of the developers of the StandaloneView.

Actions #5

Updated by Philipp Parzer about 3 years ago

Bug exists also, if you want to send an email from an eID Middleware with FluidEmail.
The view property of FluidEmail is a StandaloneView as well.

Actions #6

Updated by Georg Ringer over 2 years ago

  • Related to Bug #93646: ContentObjectRenderer gets resetted when using FluidEmail added
Actions #7

Updated by Christian Kuhn about 1 year ago

  • Status changed from Needs Feedback to Rejected

Hey.

I think we'll have to close here: The 'eid' approach is an early middleware thing before other stuff has been set up. It should only be used when this early context is enough. With middlewares in place, it is better to add an own middleware at an appropriate place, when more heavy lifting is needed instead of getting the request handled through the EidHandler. In case eid is still used for such things, any needed additional setup has to be done by the extension itself. Also note the fluid view classes have less dependencies since v11 / v12 and do not directly depend on extbase anymore.

Actions

Also available in: Atom PDF