-1
如何在此查詢中使用SQL運算符(https://www.w3schools.com/sql/sql_operators.asp)?像例如$ uidMin = 5; $ uidMax = 20; ...TYPO3 - 在QueryBuilder API v8中使用SQL運算符
$uid = 10;
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_content');
$queryBuilder->getRestrictions()->removeAll();
$statement = $queryBuilder
->select('uid', 'pid', 'header')
->from('tt_content')
->where(
$queryBuilder->expr()->eq('uid', $uid)
)
->execute();
while ($row = $statement->fetchAll()) {
$this->view->assign('inet', $row);
}
我試過的是例如(http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/query-builder.html)。
$uidMin = 5;
$uidMax = 20;
...
$queryBuilder->expr()->between('uid', $uidMin, $uidMax)
...但沒有工作。
聲明之間是相當近期的學說。你確定你運行的是支持它的版本嗎? – j4k3
似乎()之間還沒有整合:https://api.typo3.org/typo3cms/current/html/class_t_y_p_o3_1_1_c_m_s_1_1_core_1_1_database_1_1_query_1_1_expression_1_1_expression_builder.html'ExpressionBuilder類參考' –