Skip to content
This repository has been archived by the owner on Nov 11, 2020. It is now read-only.

Commit

Permalink
Rename Query::TYPE_GEO_LOCATION to TYPE_GEO_NEAR
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikola committed Jul 11, 2013
1 parent 298c888 commit 9d0dde0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/Doctrine/MongoDB/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ public function mod($mod)
*/
public function geoNear($x, $y)
{
$this->query['type'] = Query::TYPE_GEO_LOCATION;
$this->query['type'] = Query::TYPE_GEO_NEAR;
$this->query['geoNear'] = array('near' => array($x, $y));
return $this;
}
Expand Down Expand Up @@ -685,7 +685,7 @@ public function distanceMultiplier($distanceMultiplier)
*/
public function maxDistance($maxDistance)
{
if (Query::TYPE_GEO_LOCATION === $this->query['type']) {
if (Query::TYPE_GEO_NEAR === $this->query['type']) {
$this->query['geoNear']['maxDistance'] = $maxDistance;
} else {
$this->expr->maxDistance($maxDistance);
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/MongoDB/Query/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Query implements IteratorAggregate
const TYPE_GROUP = 7;
const TYPE_MAP_REDUCE = 8;
const TYPE_DISTINCT_FIELD = 9;
const TYPE_GEO_LOCATION = 10;
const TYPE_GEO_NEAR = 10;
const TYPE_COUNT = 11;

/**
Expand Down Expand Up @@ -243,7 +243,7 @@ public function execute()
case self::TYPE_DISTINCT_FIELD:
return $this->collection->distinct($this->query['distinctField'], $this->query['query'], $this->options);

case self::TYPE_GEO_LOCATION:
case self::TYPE_GEO_NEAR:
if (isset($this->query['limit']) && $this->query['limit']) {
$this->options['num'] = $this->query['limit'];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/MongoDB/Tests/Query/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ public function testGeoNearQuery()
->field('type')->equals('restaurant')
->limit(10);

$this->assertEquals(Query::TYPE_GEO_LOCATION, $qb->getType());
$this->assertEquals(Query::TYPE_GEO_NEAR, $qb->getType());

$expectedQuery = array('type' => 'restaurant');
$this->assertEquals($expectedQuery, $qb->getQueryArray());
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/MongoDB/Tests/Query/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function testGeoNearOptionsArePassed()
$collection = $this->getMockCollection();

$queryArray = array(
'type' => Query::TYPE_GEO_LOCATION,
'type' => Query::TYPE_GEO_NEAR,
'geoNear' => array(
'near' => array(50, 50),
'distanceMultiplier' => 2.5,
Expand Down

2 comments on commit 9d0dde0

@SteveTalbot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Jeremy,

The same change needs to be made in doctrine/mongodb-odm. Details here: doctrine/mongodb-odm#643

Guess this is an easy one for you to fix?

Cheers,
Steve

@jmikola
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SteveTalbot: See my reply in doctrine/mongodb-odm#643. Thanks.

Please sign in to comment.