Feature: #78116 - Extbase support for Doctrine's native DBAL Statement and QueryBuilder
See forge#78116
Description
With the change to Doctrine DBAL Extbase's direct query functionality also supports Query objects and instances of
\Doctrine\ as prepared statements instead of only \TYPO3\.
The following example could happen inside any Extbase Repository using native Doctrine DBAL statements:
$connection = $this->objectManager->get(ConnectionPool::class)->getConnectionForTable('mytable');
$statement = $this->objectManager->get(
\Doctrine\DBAL\Statement::class
'SELECT * FROM mytable WHERE uid=? OR title=?',
$connection
);
$query = $this->createQuery();
$query->statement($statement, [$uid, $title]);
Copied!
The following example shows the usage with the QueryBuilder object:
$queryBuilder = $this->objectManager->get(ConnectionPool::class)->getQueryBuilderForTable('mytable');
... do the SQL query with the query builder.
$query = $this->createQuery();
$query->statement($queryBuilder);
Copied!