#105554Enable Extbase to be used in console commands
Description
There are valid reasons to use components of Extbase such as Repositories inside a CLI.
Currently you have to employ a workaround like
Bootstrap::initializeBackendAuthentication();
$configurationManager = GeneralUtility::makeInstance(ConfigurationManagerInterface::class);
$configurationManager->setRequest(
(new ServerRequest())->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_BE)
);
And make sure that your Exbase classes are not injected but retrieved with GU:makeInstance.
Reviews 2
History 1316
-
Benjamin Franzke changed description <span data-processor="relativetime" data-value="2024-11-07T10:17:52+00:00" > 11/07/24, 10:17 </span>
-
Benjamin Franzke changed status
NewAccepted <span data-processor="relativetime" data-value="2024-11-07T10:18:27+00:00" > 11/07/24, 10:18 </span> -
Garvin Hicking changed Duplicated by #105616 <span data-processor="relativetime" data-value="2024-11-17T20:25:15+00:00" > 11/17/24, 20:25 </span>
-
Eike Starkmann commented <span data-processor="relativetime" data-value="2024-12-16T10:10:34+00:00" > 12/16/24, 10:10 </span>
-
Nikita Hovratov changed Duplicated by #105954 <span data-processor="relativetime" data-value="2025-01-23T11:12:59+00:00" > 01/23/25, 11:12 </span>
-
Felix Nagel commented <span data-processor="relativetime" data-value="2025-03-12T17:03:22+00:00" > 03/12/25, 17:03 </span>
Is there any public extension in which the workaround is implemented and working?
-
Garvin Hicking commented <span data-processor="relativetime" data-value="2025-03-12T19:31:40+00:00" > 03/12/25, 19:31 </span>
@fnagel Maybe https://gitlab.com/reelworx/typo3/t3-fakefrontend helps
-
Felix Nagel commented <span data-processor="relativetime" data-value="2025-03-13T08:57:12+00:00" > 03/13/25, 08:57 </span>
Garvin Hicking wrote in #note-7:
> @fnagel Maybe https://gitlab.com/reelworx/typo3/t3-fakefrontend helpsThanks for the hint. Looks interesting but does not work for TYPO3 v13.
-
Aimeos no-lastname-given commented and changed priority
Should haveMust have Is Regression 1 <span data-processor="relativetime" data-value="2025-03-13T10:46:15+00:00" > 03/13/25, 10:46 </span>We can confirm too that this is a problem in scheduler tasks requiring the router for generating URLs e.g. for e-mails. Thus, that part of the Aimeos extension doesn’t work for TYPO3 v13 at the moment.
-
Eike Starkmann commented <span data-processor="relativetime" data-value="2025-03-17T09:19:14+00:00" > 03/17/25, 09:19 </span>
As i mention above this extension does this:
https://github.com/undkonsorten/extbase-cli-aware-configuration-manager -
Felix Nagel commented <span data-processor="relativetime" data-value="2025-03-17T10:25:09+00:00" > 03/17/25, 10:25 </span>
Eike Starkmann wrote in #note-10:
> As i mention above this extension does this:
> https://github.com/undkonsorten/extbase-cli-aware-configuration-managerThanks for hint! Sadly, I was not able to get it running.
There is an existing ticket describing the issue: https://github.com/undkonsorten/extbase-cli-aware-configuration-manager/issues/1 -
Gerrit Code Review pushed patch set 1 for main to change 88854 status
AcceptedUnder Review <span data-processor="relativetime" data-value="2025-03-31T22:05:58+00:00" > 03/31/25, 22:05 </span> -
Gerrit Code Review pushed patch set 2 for main to change 88854 <span data-processor="relativetime" data-value="2025-04-01T04:53:00+00:00" > 04/01/25, 04:53 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 88878 <span data-processor="relativetime" data-value="2025-04-01T12:35:29+00:00" > 04/01/25, 12:35 </span>
-
Georg Ringer commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2025-04-01T13:00:11+00:00" > 04/01/25, 13:00 </span>Applied in changeset commit:7cd4e615c3ccfdbb1e1e6826992426550ab536c0.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T14:32:14+00:00" > 12/02/25, 14:32 </span>
This workaround does fix issue 1. but not 2.
We came up with a small extension to address both issues:
https://github.com/undkonsorten/extbase-cli-aware-configuration-manager
This extension provides a configuration manager for cli context in TYPO3.
You can define via site identifier where TYPO3 should look for TS in cli context.
In my option the core might need a third configuration manager for cli besides frontend and backend.