Project

General

Profile

Actions

Feature #101124

open

Make Templates optional in Extbase

Added by Aristeidis Karavas 10 months ago. Updated 10 months ago.

Status:
Needs Feedback
Priority:
Should have
Category:
Extbase
Start date:
2023-06-20
Due date:
% Done:

0%

Estimated time:
PHP Version:
8.2
Tags:
extbase, JsonResponse, HtmlResponse, view, template
Complexity:
Sprint Focus:

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


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Feature #101125: Ability to convert Domain Models to ArrayNew2023-06-20

Actions
Actions #1

Updated by Aristeidis Karavas 10 months ago

  • Tags changed from extbase, JsonView to extbase, JsonResponse, HtmlResponse, view, template
Actions #2

Updated by Stefan Froemken 10 months ago

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

Actions #3

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.

Actions #4

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

Actions #5

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!

Actions #6

Updated by Benni Mack 10 months ago

  • Related to Feature #101125: Ability to convert Domain Models to Array added
Actions

Also available in: Atom PDF