Bug #92769
closedSorting by relation fails if a constraint is set
0%
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.
Updated by Gerrit Code Review about 4 years 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 about 4 years ago
Problem could be solved by updating "doctrine/dbal" to 2.12.0
This ticket can be closed.
Updated by Riccardo De Contardi over 2 years ago
- Status changed from Under Review to Closed
@Albrecht Köhnlein Thank you for your reply and sorry for the very very late feedback;
I close this issue in agreement with the reporter.
If you think that this is the wrong decision or I have misunderstood or there is still work to be done, please reopen it or open a new issue with a reference to this one.
Thank you.