【问题标题】:Typo3 version 8.x Exception "Connection pool was not found"Typo3 版本 8.x 异常“未找到连接池”
【发布时间】:2018-04-26 09:25:05
【问题描述】:

我在typo3 8 中使用查询生成器功能,现在我收到此异常。

以下是我的错误

Uncaught TYPO3 Exception Class 'TYPO3\CMS\Core\Database\ConnectionPool' not found 

以下是我的源代码

use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;

*
*
*

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();
}

源代码有什么问题吗?

谢谢,

【问题讨论】:

    标签: typo3 typo3-8.x typo3-extensions typo3-8.7.x


    【解决方案1】:

    这可能是您的类命名空间的起点缺少\(反斜杠)的原因。

    试试这个GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class);

    【讨论】:

    • 就是这样,非常感谢
    猜你喜欢
    • 2017-04-19
    • 2018-10-16
    • 2016-08-14
    • 2011-03-09
    • 1970-01-01
    • 1970-01-01
    • 2023-02-02
    • 1970-01-01
    • 2022-11-22
    相关资源
    最近更新 更多