TYPO3 findAll()返回空数据

时间:2017-07-13 12:14:12

标签: database typo3 findall

我是TYPO3的新手。 我遇到这个问题,无法从数据库中获取数据。

我有一个配置

的插件
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Locations.' . $_EXTKEY,
'Locationsfe',
array(
    'Location' => 'list, show, showprice, listprice, listcategory, scan,sharedoffice',
    'Category' => 'list, show',
    'Pricing' => 'list, show, showprice, listprice, scan, test',
    'Template' => 'list, show',
),
// non-cacheable actions
array(
    'Location' => '',
    'Category' => '',
    'Pricing' => 'test',
    'Template' => '',
)

);

在我的控制器中我有这个功能

public function testAction() {
    // Get current language
    $currentLanguage = $GLOBALS['TSFE']->sys_language_uid;
    $pricing = $this->pricingRepository->findAll();
    print_r($pricing);
    die('Passed');
}

我还将此行添加到常量

plugin.tx_locations.persistence.storagePid = 164

我还创建了一个拼写错误的脚本

plugin.tx_locations {
view {
    templateRootPath = {$plugin.tx_locations.view.templateRootPath}
    partialRootPath = {$plugin.tx_locations.view.partialRootPath}
    layoutRootPath = {$plugin.tx_locations.view.layoutRootPath}
}
persistence {
    storagePid = 164
}
features {
    # uncomment the following line to enable the new Property Mapper.
    # rewrittenPropertyMapper = 1
}

}

但以上所有都不起作用。只是白页返回。

我也读过这个 extbase repository findAll() returns result null

那么,会发生什么?我不知道为什么。你能帮我解决一下吗?

提前致谢。

1 个答案:

答案 0 :(得分:0)

好的,我想你已经在你的后端创建了一些模型类型定价的记录;)。 那么请在你的控制器中试试这个:

$this->pricingRepository->setDefaultQuerySettings($this->pricingRepository->createQuery()->getQuerySettings()->setRespectStoragePage(false)); /* here we ignore the storage pid to be sure that we look in the entire system, if this works we have some hints that somthing with the storage pid is wrong */
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($this->pricingRepository); /*please use this for debugging is much easier with this :D*/
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($this->pricingRepository->findAll());

请你发布调试吗? 抱歉,我无法发表评论,我没有正确的声誉:(