我有我的CommandController,我用它来定义一个调度器任务来清除我的回购数据。因为某种原因这不起作用。我也无法将()新元素添加到我的$itemRepository中(在这个命令控制器中)。知道我错过了什么吗??
<?php
namespace VENDX\Items\Command;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
class TestCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\CommandController
{
/**
* itemRepository
*
* @var \VENDX\Items\Domain\Repository\ItemRepository
* @inject
*/
protected $itemRepository;
/**
* @var \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager
* @inject
*/
protected $persistenceManager;
/**
*
* @return void
*/
public function repoDeleteCommand() {
$this->$itemRepository->removeAll();
}
}
?>发布于 2015-08-20 12:52:17
好的,我解决了这个问题:
在我的第一次尝试,我试图使用回购通过上述符号。但是我忽略了没有“$”是需要@ repo的,因为名称空间已经用$this定义了。
格式错误:
public function repoDeleteCommand() {
$this->$itemRepository->removeAll();
}所以正确的格式是:
public function repoDeleteCommand() {
$this->itemRepository->removeAll();
}https://stackoverflow.com/questions/32114280
复制相似问题