doctrine2中纬度和经度的数据类型

时间:2013-09-28 05:00:05

标签: google-maps symfony doctrine-orm

我需要在Google地图中显示位置。

我正在使用Symfony2,doctrine和MySQL。

需要帮助yml / doctrine中的正确类型。

先谢谢。

2 个答案:

答案 0 :(得分:0)

从教义文档中:

  

十进制   以定点精度映射和转换数字数据。如果您需要精确的分数数字精度,则应考虑使用这种类型。

因此,我在教义中将十进制用于纬度和经度。我可以确认Decimal的精度为20,比例为16。

<key>UIAppFonts</key>
<array>
 <string>AntDesign.ttf</string>
 <string>Entypo.ttf</string>
 <string>EvilIcons.ttf</string>
 <string>Feather.ttf</string>
 <string>FontAwesome.ttf</string>
 <string>FontAwesome5_Brands.ttf</string>
 <string>FontAwesome5_Regular.ttf</string>
 <string>FontAwesome5_Solid.ttf</string>
 <string>Foundation.ttf</string>
 <string>Ionicons.ttf</string>
 <string>MaterialIcons.ttf</string>
 <string>MaterialCommunityIcons.ttf</string>
 <string>SimpleLineIcons.ttf</string>
 <string>Octicons.ttf</string>
 <string>Zocial.ttf</string>
</array>

答案 1 :(得分:-1)

我会使用“对象”数据类型并保存一个自带类型的对象,其中包含位置信息。

您可以创建一个名为“Location”的对象,该对象实现一个强制它具有纬度和经度的界面,然后使用:

$location = new \Location();
$location->setLatitude($lat);
$location->setLongitude($long);

$entity->setLocation($location);
祝你好运!