Set the lazy loading proxies on the wrapped entity objet.

@param array $relations list of relations to be lazy loaded

@return void
545039
public function setProxies(array $relations = null)
    {
        $attributes = $this->getEntityAttributes();
        $proxies = [];

        $relations = $this->getRelationsToProxy();

        // Before calling the relationship methods, we'll set the relationship
        // method to null, to avoid hydration error on class properties
        foreach ($relations as $relation) {
            $this->setEntityAttribute($relation, null);
        }

        foreach ($relations as $relation) {
            // First, we check that the relation has not been already
            // set, in which case, we'll just pass.
            if (array_key_exists($relation, $attributes) && !is_null($attributes[$relation])) {
                continue;
            }

            // If the key is handled locally and we know it not to be set,
            // we'll set the relationship to null value
            if (!$this->relationNeedsProxy($relation, $attributes)) {
                $proxies[$relation] = $this->entityMap->getEmptyValueForRelationship($relation);
            } else {
                $targetClass = $this->getClassToProxy($relation, $attributes);
                $proxies[$relation] = $this->proxyFactory->make($this->getObject(), $relation, $targetClass);
            }
        }

        foreach ($proxies as $key => $value) {
            $this->setEntityAttribute($key, $value);
        }
    }
311434
protected function getRelationsArray(array $relations): array
    {
        $relationsArray = [];
        foreach ($relations as $relation) {
            $key = $relation->getName();

            $relationsArray[$key] = (new self($relation->getJory(), $this->minified))->get();
        }

        return $relationsArray;
    }
122477
protected function cacheRelation($results, $relation)
    {
        $cache = $this->parentMapper->getEntityCache();

        $cache->cacheLoadedRelationResult($this->parent->getEntityKeyName(), $relation, $results, $this);
    }
901785
public function addCloneableRelation($relation) {
		$relations = $this->getCloneableRelations();
		if (in_array($relation, $relations)) return;
		$relations[] = $relation;
		$this->cloneable_relations = $relations;
	}
1003883
public function scopeWithout($query, $relations)
    {
        $relations = is_array($relations) ? $relations : array_slice(func_get_args(), 1);
        $relationships = array_dot($query->getEagerLoads());
        foreach ($relations as $relation) {
            unset($relationships[$relation]);
        }

        return $query->setEagerLoads([])->with(array_keys($relationships));
    }
1150855
protected function addLocalRelation(string $relation)
    {
        if (!in_array($relation, $this->localRelations)) {
            $this->localRelations[] = $relation;
        }
    }
1063101
protected function assignRelations($relations)
    {
        foreach ($relations as $relation) {
            if (!$relation instanceof RelationInterface) {
                throw new ModelException(sprintf('Relation must be an instance of RelationInterface, got "%s"', $this->getType($relation)));
            }

            foreach (array_keys($relation->keys()) as $field) {
                $this->assertField($field);
            }

            $this->relations[$relation->name()] = $relation;
        }
    }
1206488
protected function isNotEagerLoaded($relation)
    {
        return ! $relation
            || ! array_key_exists($relation, $this->query->getEagerLoads())
            || $relation === $this->query->getModel()->getTable();
    }
566768
public static function create($models, array $relations) {
        $is_one = !static::isSomeArr($models);
        if ($is_one) {
            $models = [$models];
        }
        foreach ($relations as $key => $relation) {
            $relation = static::parse($relation, $key);
            $models =  $relation->getWithMulti($models);
        }
        return $is_one ? reset($models) : $models;
    }
401560
public function eagerLoad($relationship)
	{
		if(is_array($relationship))
		{
			foreach($relationship as $key)
			{
				$this->eagerLoad[] = $key;
			}
		}
		else
		{
			$this->eagerLoad[] = $relationship;
		}
	}
5672
public function withCount( $relations )
	{
		if ( is_null( $this->query->columns ) )
		{
			$this->query->select( ['*'] );
		}

		$relations = is_array( $relations ) ? $relations : func_get_args();

		foreach ( $this->parseWithRelations( $relations ) as $name => $constraints )
		{
			// Here we will get the relationship count query and prepare to add it to the main query
			// as a sub-select. First, we'll get the "has" query and use that to get the relation
			// count query. We will normalize the relation name then append _count as the name.
			$relation = $this->getHasRelationQuery( $name );

			$query = $relation->getRelationCountQuery( $relation->getRelated()->newQuery(), $this );

			$query->callScope( $constraints );

			$query->mergeModelDefinedRelationConstraints( $relation->getQuery() );

			$this->selectSub( $query->toBase(), snake_case( $name ) . '_count' );
		}

		return $this;
	}
1089640
protected function parseWithRelations(array $relations)
    {
        $results = [];

        foreach ($relations as $name => $constraints) {
            // If the "relation" value is actually a numeric key, we can assume that no
            // constraints have been specified for the eager load and we'll just put
            // an empty Closure with the loader so that we can treat all the same.
            if (is_numeric($name)) {
                $name = $constraints;

                list($name, $constraints) = (mb_strpos($name, ':') !== false)
                            ? $this->createSelectWithConstraint($name)
                            : [$name, function () {
                                //
                            }];
            }

            // We need to separate out any nested includes. Which allows the developers
            // to load deep relationships using "dots" without stating each level of
            // the relationship with its own key in the array of eager load names.
            $results = $this->addNestedWiths($name, $results);

            $results[$name] = $constraints;
        }

        return $results;
    }
142525
public function loadRelation($relation)
    {
        //If the node isn't already loaded
        if(!isset($this->relationProxyCache[$relation->getId()]))
        {
            //Create a proxy entity
            $em = $this;
            $entity = $this->proxyFactory->fromRelation($relation, $this->metaRepository, function ($node) use ($em) {
                return $em->loadNode($node);
            });

            $this->relationProxyCache[$relation->getId()] = $entity;
            $this->everymanRelationCache[$this->getHash($entity)] = $relation;
        }

        return $this->relationProxyCache[$relation->getId()];
    }
194519
protected function initSources(array $sources)
    {
        foreach ($sources as $source) {
            $this->sources[] = new EntitySource($this, $source);
        }
    }
686597
public function initRelation(array $models, $relation)
    {
        foreach ($models as $model)
        {
            // In the case of fetching nested relations, we will get an array
            // with the first key being the model we need, and the other being
            // the related model so we'll just take the first model out of the array.
            if (is_array($model)) $model = reset($model);

            $model->setRelation($relation, null);
        }

        return $models;
    }
1057078
protected function setRelations(Jory $jory): void
    {
        $relations = $this->getArrayValue($this->joryArray, 'rlt');

        if ($relations) {
            $relations = $this->convertDotNotatedRelations($relations);
            foreach ($relations as $name => $joryData) {
                $subJory = (new self($joryData))->getJory();
                $jory->addRelation(new Relation($name, $subJory));
            }
        }
    }
252522
protected function createRelatedEntities($relations)
    {
        $entitiesToCreate = $this->aggregate->getNonExistingRelated($relations);

        foreach ($entitiesToCreate as $aggregate) {
            $this->createStoreCommand($aggregate)->execute();
        }
    }