我正在尝试运行 Synfony 命令 使其正常工作。只有这样,在命令中,才能运行如下代码片段:
Bootstrap::initializeBackendAuthentication();
$data = [...]
$dataHandler = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
$dataHandler->start($data, []);
$dataHandler->process_datamap();
运行这些 DataHandler 命令的是 _cli_
后端用户。
我已经根据文档创建了我的 Synfony 命令。它已注册,我可以这样调用它,它按预期工作:
$ vendor/bin/typo3 myext:rundatahandler
我的问题是:如何在 PHP 类中运行它?我在文档或网上都找不到它。我只为 Synfony 控制器类找到它,这些类的行为与 TYPO3 的不同,并且具有不同的输入和属性。
预先非常感谢!
I'm trying to run DataHandler commands from multiple contexts (Frontend, Backend, etc.). From what I've read and tried, this has to be done within a Synfony command for it to work properly. Only then, within the command, code snippets like these can be run:
Bootstrap::initializeBackendAuthentication();
$data = [...]
$dataHandler = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
$dataHandler->start($data, []);
$dataHandler->process_datamap();
And it's the _cli_
back-end user the one running these DataHandler commands.
I've created my Synfony command according to the docs. It's registered and I can call it like this and it works as expected:
$ vendor/bin/typo3 myext:rundatahandler
My question is: How can I run this within a PHP class? I can't find it anywere in the docs or online. I only find it for Synfony Controller classes, which behave differently and have different inputs and attributes than those of TYPO3.
Thanks a lot in advance!
发布评论
评论(1)
您可以使用
流程组件
来运行命令在你的班级里。安装
在 PHP 类中使用
注意:
另外,如果您的类无权访问供应商文件夹,那么您必须需要供应商/autoload.php
You can use
The Process Component
to run commands in your class.Installation
Use in your PHP Class
Note:
Also, if your class does not have access to the vendor folder, then you must require the vendor/autoload.php