Bug #92769

Sorting by relation fails if a constraint is set

Added by Albrecht Köhnlein 28 days ago. Updated 27 days ago.

Under Review
Should have
Target version:
Start date:
Due date:
% Done:


Estimated time:
TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


Hi everybody,

I'm having a repository, where I have defined an ordering rule by a related property. This works find for example in findAll() method, where no constraint exists. But as soon as I am setting an individual constraint, this runs in an PHP error, inside a doctrine method.

Example repository:

class TrainingRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
    protected $defaultOrderings = [
        'singleSelectRelation.title' => QueryInterface::ORDER_ASCENDING

    public function findFiltered(): QueryResultInterface
        $query = $this->createQuery();
        $query->matching($query->contains('fieldWithMMRelation', 123));
        return $query->execute();

Error message:

ArgumentCountError: Too few arguments to function Doctrine\DBAL\Query\Expression\CompositeExpression::with(), 0 passed in /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php on line 837 and exactly 1 expected


To be honest, I did not exactly investigate, if this problem only exists with constraints using a relation, or if even simple constraints fail too.


Updated by Gerrit Code Review 28 days ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66417


Updated by Albrecht Köhnlein 28 days ago

  • Description updated (diff)

Updated by Albrecht Köhnlein 28 days ago

  • Description updated (diff)

Updated by Albrecht Köhnlein 27 days ago

Problem could be solved by updating "doctrine/dbal" to 2.12.0

This ticket can be closed.

Also available in: Atom PDF