我在typo3 8中使用查询构建器功能,现在我正在收到此例外。
下面是我的错误
Uncaught TYPO3 Exception Class 'TYPO3CMSCoreDatabaseConnectionPool' not found
下面是我的源代码
use TYPO3CMSCoreDatabaseConnectionPool;
use TYPO3CMSCoreUtilityGeneralUtility;
*
*
*
public function getItems($Variable1,$Variable2)
{
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_xxxxxx');
$statement = $queryBuilder
->select('*')
->from('tx_xxxxxx AS txx')
->where(
$queryBuilder->expr()->eq('txx.field_name_1',$Variable1),
$queryBuilder->expr()->eq('txx.field_name_2',$Variable2)
)
->execute();
return $statement->fetch();
}
源代码有什么问题?
谢谢,
这可能是从类名称空间的起点缺少(Backslash(的原因。
尝试此GeneralUtility::makeInstance(TYPO3CMSCoreDatabaseConnectionPool::class);