-
Notifications
You must be signed in to change notification settings - Fork 408
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
base: main
Are you sure you want to change the base?
Conversation
…le command. Releases: main, 13.4, 12.4
private readonly ConfigurationManagerInterface $configurationManager, | ||
private readonly SiteFinder $siteFinder, | ||
private readonly MailerInterface $mailer, | ||
private readonly ExampleRepository $exampleRepository, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
$site = $this->siteFinder->getSiteByPageId(1); | ||
$request = (new ServerRequest()) | ||
->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_FE) | ||
->withAttribute('site', $site); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
…le command.
Releases: main, 13.4, 12.4