Я просто создаю инструкцию SQL и хочу поместить ее в действительный запрос построителя запросов в моем расширении Typo3.
SQL:
SELECT FROM_UNIXTIME(tx_operations_domain_model_operation.begin, '%Y') as year,
count(tx_operations_operation_type_mm.`uid_foreign`) as cont,
tx_operations_domain_model_type.`title`
FROM tx_operations_domain_model_operation
INNER JOIN
tx_operations_operation_type_mm ON (`tx_operations_operation_type_mm`.`uid_local` = tx_operations_domain_model_operation.uid)
INNER JOIN
tx_operations_domain_model_type ON (`tx_operations_domain_model_type`.`uid` = `tx_operations_operation_type_mm`.`uid_foreign`)
GROUP BY FROM_UNIXTIME(tx_operations_domain_model_operation.begin, '%Y'), tx_operations_operation_type_mm.`uid_foreign`;
Это то, что я пробовал в моем контроллере
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_operations_domain_model_operation');
$statement = $queryBuilder
->select('tx_operations_domain_model_operation.begin, \'%Y\') as year', 'count(tx_operations_operation_type_mm.`uid_foreign`) as cont')
->from('tx_operations_domain_model_operation')
->join(
'tx_operations_domain_model_operation',
'tx_operations_operation_type_mm',
$queryBuilder->expr()->eq('tx_operations_operation_type_mm.uid_local', $queryBuilder->quoteIdentifier('tx_operations_domain_model_operation.uid'))
)
->join(
'tx_operations_operation_type_mm',
'tx_operations_domain_model_type',
$queryBuilder->expr()->eq('tx_operations_domain_model_type.uid_local', $queryBuilder->quoteIdentifier('tx_operations_operation_type_mm.uid_foreign'))
)
->groupBy('UNIXTIME(tx_operations_domain_model_operation.begin, \'%Y\')', 'tx_operations_operation_type_mm.`uid_foreign')
->execute();
Любая идея, как должно выглядеть представление построителя запросов?