Paradox/toolbox/Finder.php
private function generateReferenceData($reference)
    {
        if ($reference instanceof AModel) {
            $coordinates = $reference->getPod()->getCoordinates();

            if (!$coordinates) {
                throw new FinderException("To use a pod as a reference point, it must have a geo index on its collection and have coordinates assigned.");
            }

            $coordinates['podId'] = $reference->getPod()->getId();
        } elseif (is_array($reference)) {

            if (count($reference) == 2 && array_key_exists('latitude', $reference) && array_key_exists('longitude', $reference)) {
                $coordinates = $reference;
                $coordinates['podId'] = null;
            } else {
                throw new FinderException('$position array passed to findNear() must contain 2 keys: latitude and longitude.');
            }

        } else {
            throw new FinderException('$position must be either an instance of AModel or an array containing the latitude and longitude.');
        }

        return $coordinates;
    }
private function generateReferenceData($reference)
    {
        if ($reference instanceof AModel) {
            $coordinates = $reference->getPod()->getCoordinates();

            if (!$coordinates) {
                throw new FinderException("To use a pod as a reference point, it must have a geo index on its collection and have coordinates assigned.");
            }

            $coordinates['podId'] = $reference->getPod()->getId();
        } elseif (is_array($reference)) {

            if (count($reference) == 2 && array_key_exists('latitude', $reference) && array_key_exists('longitude', $reference)) {
                $coordinates = $reference;
                $coordinates['podId'] = null;
            } else {
                throw new FinderException('$position array passed to findNear() must contain 2 keys: latitude and longitude.');
            }

        } else {
            throw new FinderException('$position must be either an instance of AModel or an array containing the latitude and longitude.');
        }

        return $coordinates;
    }
Convience function to turn a AModel or array of coordinates into an acceptable associative array for find*Near() methods.
@param  AModel|array    $reference The reference point. This can be a model or an associative array containing latitude and longitude keys.
@throws FinderException
@return array