looptribe/sonata-spatial

此包已被废弃,不再维护。作者建议使用looptribe/form-spatial包。

Symfony2表单的Google Maps空间支持

安装: 51

依赖项: 0

建议者: 0

安全性: 0

星标: 7

关注者: 5

分支: 5

类型:symfony-bundle

v0.0.3 2018-04-19 14:36 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:32:24 UTC


README

使用Google Maps为Symfony2表单提供空间支持。

Package version

此包是creof/doctrine2-spatial的Symfony2表单集成。它添加了一个新的表单类型point,用于使用Google Maps编辑空间Point类型。

安装

$ php composer.phar require looptribe/form-spatial dev-master
<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Looptribe\FormSpatialBundle\LooptribeFormSpatialBundle(),
        // ...
    );
}
# app/config/parameters.yml
parameters:
    looptribe.formspatial.google_maps_api_key: YOUR_API_KEY

使用

当您创建表单时,将Point字段类型设置为Looptribe\FormSpatialBundle\Form\Type\PointType

<?php
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            // ...
            ->add('location', Looptribe\FormSpatialBundle\Form\Type\PointType::class)
            // ...
        ;
    }

开发

目前只支持地理Point类型。