looptribe/sonata-spatial

This package is abandoned and no longer maintained. The author suggests using the looptribe/form-spatial package instead.

Spatial support for Symfony2 forms with Google Maps

Installs: 51

Dependents: 0

Suggesters: 0

Security: 0

Stars: 7

Watchers: 5

Forks: 5

Type: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

Spatial support for Symfony2 forms with Google Maps.

Package version

This package is a Symfony2 forms integration of creof/doctrine2-spatial. It adds a new form type point to edit spatial Point types with Google Maps.

Installation

$ 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

Usage

When you create a form set your Point field type as Looptribe\FormSpatialBundle\Form\Type\PointType:

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

Development

At the moment only the geography Point type is supported.