eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\MapLocationDistance::getBoundingConstraints PHP Method

getBoundingConstraints() protected method

Credit for the formula goes to http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates.
protected getBoundingConstraints ( eZ\Publish\Core\Persistence\Database\SelectQuery $query, eZ\Publish\API\Repository\Values\Content\Query\Criterion\Value\MapLocationValue $location, float $distance ) : array
$query eZ\Publish\Core\Persistence\Database\SelectQuery
$location eZ\Publish\API\Repository\Values\Content\Query\Criterion\Value\MapLocationValue
$distance float
return array
    protected function getBoundingConstraints(SelectQuery $query, MapLocationValue $location, $distance)
    {
        $boundingCoordinates = $this->getBoundingCoordinates($location, $distance);
        return array($query->expr->gte($this->dbHandler->quoteColumn('latitude', 'ezgmaplocation'), $query->bindValue($boundingCoordinates['lowLatitude'])), $query->expr->gte($this->dbHandler->quoteColumn('longitude', 'ezgmaplocation'), $query->bindValue($boundingCoordinates['lowLongitude'])), $query->expr->lte($this->dbHandler->quoteColumn('latitude', 'ezgmaplocation'), $query->bindValue($boundingCoordinates['highLatitude'])), $query->expr->lte($this->dbHandler->quoteColumn('longitude', 'ezgmaplocation'), $query->bindValue($boundingCoordinates['highLongitude'])));
    }