コード例 #1
0
 public function getId()
 {
     if ($this->__isInitialized__ === false) {
         return (int) $this->_identifier["id"];
     }
     $this->__load();
     return parent::getId();
 }
コード例 #2
0
 public function getNeighborhoodPolygonsAsGeoJsonByRegion(Region $region)
 {
     if (empty($region->getId())) {
         throw new \InvalidArgumentException("region.id must not be null");
     }
     $sql = "SELECT whathood.latest_neighborhoods_geojson(:regionId) as geojson";
     $rsm = new ResultSetMapping();
     $rsm->addScalarResult('geojson', 'geojson');
     $query = $this->em->createNativeQuery($sql, $rsm);
     $query->setParameter('regionId', $region->getId());
     $result = $query->getSingleResult();
     $geojson = $result['geojson'];
     if (preg_match('/"features":null/', $geojson)) {
         throw new \Exception("no neighborhood polygons returned for region '" . $region->getName() . "'");
     } else {
         return $geojson;
     }
 }
コード例 #3
0
 private function getBoundaryAsGeoJsonFromDb(Region $region)
 {
     $sql = "SELECT whathood.latest_neighborhoods_geojson(:regionId) as geojson";
     $rsm = new ResultSetMapping();
     $rsm->addScalarResult('geojson', 'geojson');
     $query = $this->em->createNativeQuery($sql, $rsm);
     $query->setParameter('regionId', $region->getId());
     $result = $query->getSingleResult();
     $geojson = $result['geojson'];
     if (preg_match('/"features":null/', $geojson)) {
         throw new \Exception("no neighborhood polygons returned for region '" . $region->getName() . "'");
     }
     return $geojson;
 }