"require": {
....
"padam87/address-bundle": "dev-master"
},
Install BazingaGeocoderBundle
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Padam87\AddressBundle\Padam87AddressBundle(),
);
}
Add the bundle to jms_di_extra if all_bundles is false
jms_di_extra:
locations:
all_bundles: false
bundles: [Padam87AddressBundle]
Update Your schema
You can create a relation to one of the Entities, or you can use one of the traits.
$formatted = $this->get("padam87.address.formatter")->format($address);
use Padam87\AddressBundle\Service\FormatterService;
...
$formatted = $this->get("padam87.address.formatter")->format($address, FormatterService::FLAG_NOBR);
FLAG_NOBR
No linebreak will be added
FLAG_HTML
Outputs the address in html format
{{ address|address()|raw }}
This will output the formatted address, with the FLAG_HTML
added by default
$address = new GeocodedAddress();
The listener will take care of the rest ;)