Project

General

Profile

Actions

Bug #92769

closed

Sorting by relation fails if a constraint is set

Added by Albrecht Köhnlein about 4 years ago. Updated over 2 years ago.

Status:
Closed
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.

Actions

Also available in: Atom PDF