Bug #92769

Sorting by relation fails if a constraint is set

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

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2020-11-04
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

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

/var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/Expression/CompositeExpression.php:119
/var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php:837
/var/www/html/private/typo3/sysext/core/Classes/Database/Query/QueryBuilder.php:666
/var/www/html/private/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php:1062
/var/www/html/private/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php:316
/var/www/html/private/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php:205
/var/www/html/private/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php:359
/var/www/html/private/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php:220
/var/www/html/private/typo3/sysext/extbase/Classes/Persistence/Generic/PersistenceManager.php:115
/var/www/html/private/typo3/sysext/extbase/Classes/Persistence/Generic/QueryResult.php:129

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.

#1

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

#2

Updated by Albrecht Köhnlein 28 days ago

  • Description updated (diff)
#3

Updated by Albrecht Köhnlein 28 days ago

  • Description updated (diff)
#4

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