Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Add information on how to create a frontend request in a conso… #5375

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

linawolf
Copy link
Member

…le command.

Releases: main, 13.4, 12.4

private readonly ConfigurationManagerInterface $configurationManager,
private readonly SiteFinder $siteFinder,
private readonly MailerInterface $mailer,
private readonly ExampleRepository $exampleRepository,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is a extbase repository, this should fail in v13+. Request set in ConfigurationManager(Interface) already reaquired for that. Schnitzler worked
on a change to mitigate this, not sure if that has been merged or not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://forge.typo3.org/issues/105554 it does not work in 13 either and there is no change attached to my ticket either even though it was accepted. Doesnt even work in TYPO3 14 as far as I know?

@linawolf linawolf added backport 12.4 Backport to TYPO3v12 backport 13.4 Backport to TYPO3v13 labels Feb 25, 2025
$site = $this->siteFinder->getSiteByPageId(1);
$request = (new ServerRequest())
->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_FE)
->withAttribute('site', $site);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only do that, if you exactly know what you're go to do und know what you, extbase and fluid is needed. That way you have access to site config and site sets. But if your repository or fluid depends on lib.whatever, you need to add "typoscript" to request. If you need f:link you should make sure to define the router as attribute, too. You need internal linking? Maybe you also need the page and maybe the pageInformation attribute. You don't have access to current cOjb. That will be created with empty state, which also may result into problems. Your solution works, as long as your implementation needs a very basic environment. I miss a hint, that this is a bad approach, the "real" solution is using the Doctrine QueryBuilder (SELECT), or maybe DataHandler (INSERT/UPDATE/DELETE). But, yes, I'm with you that Fluid-Templating should also work in CLI context and TYPO3 should provide a solution for that on its own.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So until someone ™️ provides a solution should we document this or not? I am always searching for this when I want to send an email from cli context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 12.4 Backport to TYPO3v12 backport 13.4 Backport to TYPO3v13
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants