douhao2153
douhao2153
2012-04-25 02:41
浏览 38
已采纳

在Symfony 2 / Doctrine 2实体中存储空间点?

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! :)

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • dongqin1861
    dongqin1861 2012-04-25 06:34
    已采纳

    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/

    点赞 评论
  • dpgvdfg321041670
    dpgvdfg321041670 2012-08-11 12:10

    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.

    点赞 评论
  • dsyua2828
    dsyua2828 2014-10-24 19:41

    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.

    点赞 评论

相关推荐