2017 © Pedro Peláez
 

library geobundle

Doctrine Geo extensions

image

alireza/geobundle

Doctrine Geo extensions

  • Tuesday, January 24, 2017
  • by sanfrancisco_me
  • Repository
  • 0 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

This bundle provides a simple integration for the MySQL POINT-Datatype and some distance calculations., (*1)

Please note: This bundle is at an early stage of development, use it at your own risk!, (*2)

Installation

Please install this bundle via composer (via a custom repository) and add the following options into your config.yml:, (*3)

doctrine:
    dbal:
        types:
            point: Digilist\GeoBundle\ORM\PointType
        mapping_types:
            point: point

    orm:
        dql:
            numeric_functions:
                DISTANCE: Digilist\GeoBundle\ORM\Distance

Usage

After installation, you can now use the new POINT Datatype within your entity definitions., (*4)

/**
 * @Column(type="point")
 */
private $coordinates;

Distance Calculation (you can use the DISTANCE function anywhere in the query builder or in your DQL function):, (*5)

// Query Builder
$qb = $this->getEntityManager()->createQueryBuilder();
$qb->from('Company', 'c')
   ->where('DISTANCE(c.coordinates, :lat, :lng) < 20')
   ->setParameter('lat', $point->getLatitude())
   ->setParameter('lng', $point->getLongitude());

The Versions

24/01 2017

dev-master

9999999-dev

Doctrine Geo extensions

  Sources   Download

MIT

The Requires

 

by Alireza Rahmani