Spatial support for Symfony2 forms with Google Maps.
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.
$ 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
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)
// ...
;
}
At the moment only the geography Point
type is supported.