Feature #101124
openMake Templates optional in Extbase
0%
Description
Since ResponseInterface has been introduced, one can define a return type, JsonResponse , HtmlResponse etc.
The problem here is that using for example JsonResponse with Extbase and not defining a template for it, TYPO3 throws an exception. Now, we have to add a template and format it to a json structure which could be PITA, specially when the JSON is huge. One could use Middlewares , but with TYPO3 12, one can not use Extbase features if not in Extbase context. So now we are in a dead end.
Solution
Make the template requirement optional, or add a method which deactivates it for the action, like
$this->view->withTemplate(false);
Files
Updated by Aristeidis Karavas 10 months ago
- Tags changed from extbase, JsonView to extbase, JsonResponse, HtmlResponse, view, template
Updated by Stefan Froemken 10 months ago
- File Bildschirmfoto 2023-06-24 um 12.43.33.png Bildschirmfoto 2023-06-24 um 12.43.33.png added
- Status changed from New to Needs Feedback
- Assignee set to Stefan Froemken
Hello,
thank you for that information.
I have just tried to reproduce that problem, but I don't get any error message.
Please have a look into my uploaded picture here. There is no TypoScript, I return a JsonResponse and I have renamed the template for given action. I works like expected.
So please add some further information how to reproduce this issue.
Stefan
Updated by Aristeidis Karavas 10 months ago
As explained in the description, the problem is when you do NOT define a template for a JSON response. Why would we need a template for json in the first place. Json has only one structure, a string. No need for any templating.
Updated by Stefan Froemken 10 months ago
Hello Karavas,
as I have written: I have deactivated all templates to test your issue. Please have a look into my uploaded picture. There is a return statement in row 35. So all other lines behind are not executed.
I need further information from you on how to reprocuce your issue.
Stefan
Updated by Christian Hackl 10 months ago
Stefan Froemken wrote in #note-4:
Hello Karavas,
as I have written: I have deactivated all templates to test your issue. Please have a look into my uploaded picture. There is a return statement in row 35. So all other lines behind are not executed.
I need further information from you on how to reprocuce your issue.
Stefan
Can you please adjust this minimal example extension (https://github.com/Hauer-Heinrich/ext_key) accordingly? i don't get it either :)
Thank you!
Updated by Benni Mack 10 months ago
- Related to Feature #101125: Ability to convert Domain Models to Array added