API Platform version(s) affected: 3.1.x
Description
Currently APIP assumes that Doctrine\ORM\Query\Expr`\Join::getCondition() returns a string and uses it as such in ApiPlatform\Doctrine\Orm\Extension\FilterEagerLoadingExtension (see here, it's used in preg_replace :
|
$condition = preg_replace($this->buildReplacePatterns($aliases), $replacements, $joinPart->getCondition() ?? ''); |
).
If you try using a Doctrine Expr instead, you unsurprinsingly get an error similar to
preg_replace(): Argument #3 ($subject) must be of type array|string, Doctrine\ORM\Query\Expr\Comparison give
How to reproduce
Have a custom filter that adds a join($stuff, $alias, Join::WITH, $queryBuilder->expr()->like('whatever', 'something')).
Use it in conjunction with a "normal" SearchFilter.
Possible Solution
Testing whether getCondition() returns an Expr and convert it into a string maybe? Doctrine should have a usable utility somewhere, but i haven't looked into it yet.
API Platform version(s) affected: 3.1.x
Description
Currently APIP assumes that Doctrine\ORM\Query\Expr`\Join::getCondition() returns a string and uses it as such in ApiPlatform\Doctrine\Orm\Extension\FilterEagerLoadingExtension (see here, it's used in preg_replace :
core/src/Doctrine/Orm/Extension/FilterEagerLoadingExtension.php
Line 187 in f794201
If you try using a Doctrine Expr instead, you unsurprinsingly get an error similar to
How to reproduce
Have a custom filter that adds a join($stuff, $alias, Join::WITH, $queryBuilder->expr()->like('whatever', 'something')).
Use it in conjunction with a "normal" SearchFilter.
Possible Solution
Testing whether getCondition() returns an Expr and convert it into a string maybe? Doctrine should have a usable utility somewhere, but i haven't looked into it yet.