In SQL it's possible to make a where statement that is true, without actually writing 'column = true'. Instead you can use 'column' and the query will then return all the rows where it's true.
As far as I can figure out, this isn't a possibility in doctrine's query builder and when I try anything similar, the following QueryException is thrown:
[Syntax Error] line 0, col 428: Error: Expected =, <, <=, <>, >, >=, !=, got 'AND'
Are there any way to get around this issue? It has to be a solution involving the query builder.
Edit:
Here's the code in question:
$qb->andWhere("MBRContains(:linestring, location.position) = true")
which I would very much like to be:
$qb->andWhere("MBRContains(:linestring, location.position)")
The issue is that MBRContains doesn't use the spatial index in the first case. MBRContains is from a doctrine extension, but the issue could be simplified down to:
$qb->andWhere("account.email_validated")
which wouldn't work either.