LMongo\Eloquent\Builder::parseNested PHP Method

parseNested() protected method

Parse the nested relationships in a relation.
protected parseNested ( string $name, array $results ) : array
$name string
$results array
return array
    protected function parseNested($name, $results)
    {
        $progress = array();
        // If the relation has already been set on the result array, we will not set it
        // again, since that would override any constraints that were already placed
        // on the relationships. We will only set the ones that are not specified.
        foreach (explode('.', $name) as $segment) {
            $progress[] = $segment;
            if (!isset($results[$last = implode('.', $progress)])) {
                $results[$last] = function () {
                };
            }
        }
        return $results;
    }