由于使用了ajax我配置了eID,请参阅以下内容: 我想使用我的扩展的现有存储库。所以我通过ext_localconf.php加载一个控制器,它可以工作,我在TestController中:
$TYPO3_CONF_VARS['FE']['eID_include']['ajaxDispatcher'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('exacallmanagement').'Classes/Controller/TestController.php';
在TestController中我运行:
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('VENDOR\Exacallmanagement\Classes\Domain\Repository\CallhistoryRepository');
命名空间应该是正确的,我总是得到一个: 致命错误:第4114行的/Users/jacques/Sites/_typo3_engines/6.1.6/typo3/sysext/core/Classes/Utility/GeneralUtility.php中找不到类'\ VENDOR \ Exacallmanagement \ Classes \ Domain \ Repository \ CallhistoryRepository'
任何提示?
答案 0 :(得分:1)
您不应该使用makeInstance来创建存储库的实例。您应首先获取ObjectManager的实例,然后使用它来获取存储库:
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('\TYPO3\CMS\Extbase\Object\ObjectManager');
$sampleRepository= $objectManager->get('\My\Extension\Domain\Repository\SampleRepository');