将TYPO3 Extbase任务迁移到Symphony命令

问题描述

我正在尝试将扩展名pb_social迁移到TYPO3 10 LTS,但是我陷入了从社交订阅源更新TYPO3数据的调度程序任务的迁移。

我学习了如何在Services.yaml文件中注册Symfony控制台命令,以便执行该命令。

问题在于pb_social扩展名与其实际updateFeedDataCommand命令一样依赖于Extbase。

因此,我尝试以Symfony样式及其示例方法execute()创建一个新命令:

$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
/** @var PBSocialCommandController $controller */
$controller = $objectManager->get(PBSocialCommandController::class);

我已经更新了pb_social方法的属性以使用新的@TYPO3\CMS\Extbase\Annotation\Inject,但是注入似乎仍然无效。

例如与:

/**
* @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
* @TYPO3\CMS\Extbase\Annotation\Inject
*/
protected $configurationManager;

$ this-> configurationManager在使用时为空。

可能是什么问题?

解决方法

使用Method Injection

保存
/**
 * @param ConfigurationManager $configurationManager
 */
public function injectConfigurationManager(ConfigurationManager $configurationManager)
{
    $this->configurationManager = $configurationManager;
}

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...