Symfony 2 doesn't have the spatial points datatype that MySQL supports. I couldn't find anything on the Doctrine 2 documentation about this particular data type, so, does anyone know how to work with points in Symfony 2? Also, how to query based on a radius? Thanks! :)
The easiest way would be to implement custom types for the spatial data types, and then declare custom DQL functions to make querying them simpler.
I wrote about this here: http://codeutopia.net/blog/2011/02/19/using-spatial-data-in-doctrine-2/
Another option would be to use the djlambert/doctrine2-spatial bundle, found here: https://github.com/creof/doctrine2-spatial
No need to implement any custom stuff.
If you speak french, youd could get some inspiration with another article here : http://blog.fastre.info/2012/02/doctrine2-2-2-et-types-geographiques/
This classes were build for a Postgresql + Postgis Database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With