Repository/ProductRepository.php
public function BaseGeoProductQuery(LatLng $latLng)
    {
        $products = $this->getEntityManager()->createQueryBuilder()
            ->from('HarvestCloudCoreBundle:Product', 'p')
            ->select('p')
            ->addSelect('GEO(p.latitude = :latitude, p.longitude = :longitude) AS distance')
            ->setParameter('latitude', $latitude)
            ->setParameter('longitude', $longitude)
            ->orderBy('distance')
            ->where('GEO(p.latitude = :latitude, p.longitude = :longitude) <= 50')
            ->getQuery()
            ->execute();

        return $products;
    }
public function BaseGeoProductQuery(LatLng $latLng)
    {
        $products = $this->getEntityManager()->createQueryBuilder()
            ->from('HarvestCloudCoreBundle:Product', 'p')
            ->select('p')
            ->addSelect('GEO(p.latitude = :latitude, p.longitude = :longitude) AS distance')
            ->setParameter('latitude', $latitude)
            ->setParameter('longitude', $longitude)
            ->orderBy('distance')
            ->where('GEO(p.latitude = :latitude, p.longitude = :longitude) <= 50')
            ->getQuery()
            ->execute();

        return $products;
    }
public function BaseGeoProductQuery ( LatLng $ latLng ) { $ products = $ this -> getEntityManager ( ) -> createQueryBuilder ( ) -> from ( 'HarvestCloudCoreBundle:Product' , 'p' ) -> select ( 'p' ) -> addSelect ( 'GEO(p.latitude = :latitude, p.longitude = :longitude) AS distance' ) -> setParameter ( 'latitude' , $ latitude ) -> setParameter ( 'longitude' , $ longitude ) -> orderBy ( 'distance' ) -> where ( 'GEO(p.latitude = :latitude, p.longitude = :longitude) <= 50' ) -> getQuery ( ) -> execute ( ) ; return $ products ; }
Base Geographical Product Query

@author Tom Haskins-Vaughan <tom@harvestcloud.com>
@since  2012-04-15
@todo   Create SearchFilter class

@param  LatLng  $latLng
Base Geographical Product Query