Custom filter with nativeQuery

Viewed 138

I want to perform a custom filter to retrieve an area inside a boundingBox via a custom filter

basic query will be like this:

SELECT * FROM public.area
where coord  
    @ ST_MakeEnvelope (
        -71, 48, 
        -72, 49)

In filterProperty method we have access only to the queryBuilder (due to the logic of apiplatform)

that we look something like this:

$queryBuilder
    ->andWhere('o.coord @ ST_MakeEnvelope(:min_x, :min_y, :max_x, :max_y))')

but doctrine parser throw an error because of the unknown operator (see How do I use custom-operators in Doctrine DQL?)

so my only option is to perform a nativeQuery but with the logic of ApiPlatform I don't know how to achieve that, im not sure if it's even possible without breaking the logic of ApiPlatform filter

package used for postGIS is https://github.com/jsor/doctrine-postgis

0 Answers
Related