Issue Bug Closed

#105554Enable Extbase to be used in console commands

Lina Wolf 11/07/24, 10:15 updated 12/02/25, 14:32

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