class RemoveHiddenPages extends Symfony\Component\Console\Command\Command
{
protected function execute(InputInterface $input, OutputInterface $output)
{
Bootstrap::initializeBackendAuthentication();
$uid = someuid;
$cmd['pages'][$uid]['delete'] = 1;
$dataHandler = GeneralUtility::makeInstance(DataHandler::class);
$dataHandler->start([], $cmd);
$dataHandler->process_cmdmap();
// ....
I try to run the command from the command line. This results in an exception:
Tue, 17 Mar 2020 10:14:15 +0100 [CRITICAL] request="684c29a15bc6b" component="TYPO3.CMS.Core.Error.DebugExceptionHandler":
Core: Exception handler (CLI): Uncaught TYPO3 Exception: Argument 1 passed to
TYPO3\CMS\Core\Session\Backend\DatabaseSessionBackend::update() must be of the type string, null given,
called in /site/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php on line 1311
| TypeError thrown in file /site/typo3/sysext/core/Classes/Session/Backend/DatabaseSessionBackend.php in line 159
- {"exception":{"xdebug_message":"\nTypeError: Argument 1 passed to
TYPO3\\CMS\\Core\\Session\\Backend\\DatabaseSessionBackend::update()
must be of the type string, null given, called in ....
In DataHandler::deletePages()
a flash message is sent. This seems to cause the problem, as the session is not initialized. Is it possible to use the DataHandler in command controllers?
The example is based on:
- https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/CommandControllers/Index.html
- https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Typo3CoreEngine/UsingDataHandler/Index.html
I am using TYPO3 9.5.14