creof/doctrine2-spatial

ST_* function arguments not recognized

yurtesen opened this issue · 0 comments

I am not sure what I am doing wrong.

I have only 2 functions defined in the config.yml

                 ST_Intersects:       CrEOF\Spatial\ORM\Query\AST\Functions\PostgreSql\STIntersects
                 ST_MakeEnvelope:     CrEOF\Spatial\ORM\Query\AST\Functions\PostgreSql\STMakeEnvelope

I am trying to execute a simple query

->where('ST_Intersects(st.coords,ST_MakeEnvelope(-1,-1,1,1,4326))=true')

I get an error (I believe the dash is the minus dash of first element):

Error: Expected Literal, got '-'

I had no problems with the entity and doctrine generating database tables, fiends and indices.

Update: I have managed to get things working by wrapping then negative arguments in quotes. So the code below works:

->where("ST_Intersects(st.coords,ST_MakeEnvelope('-1','-1',1,1,4326))=true")

I think the problem is in AbstractSpatialDQLFunction.php in lines 77 and 82

    `$this->geomExpr[] = $parser->ArithmeticPrimary();`

Should perhaps be ?

    `$this->geomExpr[] = $parser->ArithmeticFactor();`