You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue description obviously produces expectation that solution would let you validate query builders created using (1)RepositoryClass::createQueryBuilder as a common use case, and not just ones from (2) ->getEntityManager()->createQueryBuilder()
But PR "solving" it is less clear on what it does.
In practice all i get with (1) is 'Could not analyse QueryBuilder with dynamic arguments.'. RepositoryClass::createQueryBuilder naturally accepts alias and optional indexBy as opposed to ->getEntityManager()->createQueryBuilder(), so i guess it's "dynamic"
Even if that is intended to (not) work like that it's normally not even possible to realize something is wrong, as reportDynamicQueryBuilders is false by default, so for average user with repo-based queries using createQueryBuilder extension just silently fails to do any validation, which is a very weird decision and takes long time to debug.
class UserRepository extends EntityRepository
{
public function findWorks(): User
{
return $this
->getEntityManager()
->createQueryBuilder()
->select('u')
->from(User::class, 'u')
->andWhere('u.dsdsf = :id')
->setParameter('id', 1)
->getQuery()
->getResult();
}
public function findFailDynamic(): User
{
return $this->createQueryBuilder('u')
->select('u')
->andWhere('u.asdfd = :id')
->setParameter('id', 1)
->getQuery()
->getResult();
}
The text was updated successfully, but these errors were encountered:
Regarding
#66
and solution for it
#140
Issue description obviously produces expectation that solution would let you validate query builders created using (1)
RepositoryClass::createQueryBuilder
as a common use case, and not just ones from (2)->getEntityManager()->createQueryBuilder()
But PR "solving" it is less clear on what it does.
In practice all i get with (1) is
'Could not analyse QueryBuilder with dynamic arguments.'
.RepositoryClass::createQueryBuilder
naturally acceptsalias
and optionalindexBy
as opposed to->getEntityManager()->createQueryBuilder()
, so i guess it's "dynamic"Even if that is intended to (not) work like that it's normally not even possible to realize something is wrong, as
reportDynamicQueryBuilders
is false by default, so for average user with repo-based queries usingcreateQueryBuilder
extension just silently fails to do any validation, which is a very weird decision and takes long time to debug.The text was updated successfully, but these errors were encountered: