I don't know this is a issue or not, but just can't find any answer about it, please help:
// ACME\CommonBundle\Entity\Location.php
namespace ACME\CommonBundle\Entity;
use Doctrine\ORM\Mapping as ORM,
Symfony\Component\Validator\Constraints as Assert,
Vich\GeographicalBundle\Annotation as Vich;
/**
* @ORM\Entity
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({
* "branch" = "\ACME\BranchBundle\Entity\Branch",
* "place" = "Place"
* })
*
* @Vich\Geographical
*
*/
class Location
{
......
/**
* @ORM\Column(type="decimal", scale=7, nullable=true)
* @var decimal
*/
protected $latitude;
/**
* @ORM\Column(type="decimal", scale=7, nullable=true)
* @var decimal
*/
protected $longitude;
......
/**
* Set latitude
*
* @param decimal $latitude
*/
public function setLatitude($latitude)
{
$this->latitude = $latitude;
}
/**
* Set longitude
*
* @param decimal $longitude
*/
public function setLongitude($longitude)
{
$this->longitude = $longitude;
}
/**
* @Vich\GeographicalQuery
*/
public function getFullAddress()
{
return sprintf(
'%s, %s %s',
$this->address,
implode(', ', $this->geography->getFullGeographyHierarchyArray()),
$this->zipCode
);
}
}
//ACME\BranchBundle\Entity\Branch.php
namespace ACME\BranchBundle\Entity;
use ACME\CommonBundle\Entity\Location,
......
/**
* ACME\BranchBundle\Entity\Branch
......
*/
class Branch extends Location
{
......
}
When I create and persist new Branch entity, the latitude and longitude all remained null, did I miss anything?
PS. I crawled around web and found than I needed some 'key' to use the Google Geocode API, but the documentation of this bundle didn't mention about it, was that what I missed?