Set the constraints for an eager load of the relation.

@param  array  $models
@return void
354914
public function addEagerConstraints(array $models)
    {
        // Get the parent node's placeholder.
        $parentNode = $this->query->getQuery()->modelAsNode($this->parent->getTable());
        // Tell the query that we need the morph model and the relationship represented by CypherGrammar
        // statically with 'r'.
        $this->query->select('r', $parentNode, $this->relation);
        // Add morph mutation that will tell the parser about the property name on the Relationship that is holding
        // the class name of our morph model so that they can instantiate the correct one, and pass the relation
        // name as an indicator of the Node that has our morph attributes in the query.
        $this->query->addMutation($parentNode, $this->parent);
        $this->query->addEagerMorphMutation($this->relation);
        // Set the parent node's placeholder as the RETURN key.
        $this->query->getQuery()->from = array($parentNode);
        // Build the MATCH ()<-[]-() Cypher clause.
        $this->query->matchMorphOut($this->parent, $this->relation, $this->foreignKey, $this->parent->{$this->foreignKey});
        // Add WHERE clause over the parent node's matching keys [values...].
        $this->query->whereIn($this->foreignKey, $this->getKeys($models));
    }
542026
public function setObjects(array $objects)
    {
        foreach ($objects as $object) {
            $this->checkType(ObjectInFolderDataInterface::class, $object);
        }

        $this->objects = $objects;
    }
1139066
public function addConstraints()
    {
        if (static::$constraints) {
            // For belongs to relationships, which are essentially the inverse of has one
            // or has many relationships, we need to actually query on the primary key
            // of the related models matching on the foreign key that's on a parent.
            $this->query->where($this->otherKey, '=', $this->parent->{$this->foreignKey});
        }
    }
177824
def add_eager_constraints(self, models):
        
        self._models = Collection.make(models)
        self._build_dictionary(models)
1285173
protected function eagerLoadRelation(array $models, $name, Closure $constraints)
    {
        // First we will "back up" the existing where conditions on the query so we can
        // add our eager constraints. Then we will merge the wheres that were on the
        // query back to it in order that any where conditions might be specified.
        $relation = $this->getRelation($name);

        $relation->addEagerConstraints($models);

        $constraints($relation);

        // Once we have the results, we just match those back up to their parent models
        // using the relationship instance. Then we just return the finished arrays
        // of models which have been eagerly hydrated and are readied for return.
        return $relation->match(
            $relation->initRelation($models, $name),
            $relation->getEager(), $name
        );
    }
1322012
def add_eager_constraints(self, models):
        
        key = "%s.%s" % (self._related.get_table(), self._other_key)

        self._query.where_in(key, self._get_eager_model_keys(models))
21519
public function handleModels(array $models)
    {
        $builder = $this->builder;

        $builder->start();

        foreach ($models as $model) {
            $languages = (array)(isset($model->sitemapLanguages) ? $model->sitemapLanguages : Yii::$app->language);

            if (count($languages) > 1) {
                // Handle separately for each language
                foreach ($languages as $language) {
                    // Swith App language to $language
                    if (isset($model->sitemapSwithLanguages) && $model->sitemapSwithLanguages) {
                        static::setLanguage($language);
                    }

                    $this->handleModel($model, $language);

                    // Restore App language
                    static::restoreLanguage();
                }
            } else {
                // Handle only one language
                $this->handleModel($model, null);
            }
        }

        $builder->finish();
    }
962212
public function delete($models)
    {
        $model = $models->first();

        if (! $this->shouldMaintainIndex($model)) {
            return;
        }

        $indexColumn = $this->getIndexColumn($model);
        $key = $model->getKeyName();

        $ids = $models->pluck($key)->all();

        $this->database
            ->table($model->searchableAs())
            ->whereIn($key, $ids)
            ->update([$indexColumn => null]);
    }
737675
public function addConstraints()
    {
        if (static::$hasConstraints) {
            // For belongs to relationships, which are essentially the inverse of has one
            // or has many relationships, we need to actually query on the primary key
            // of the related models matching on the foreign key that's on a parent.
            $foreign_keyValue = $this->parent->getAttribute($this->foreign_key);
            $this->query->where($this->local_key, '=', $foreign_keyValue);
        }
    }
126953
public function addRelations($relations)
	{
		if(is_numeric($relations))
		{
			
			$relations = intval($relations);
			$this->relations = $relations;
		}
		else
		{
			$relations = ( is_array($relations) ) ? $relations : explode(',', strval($relations));
			foreach ($relations as $prop)
			{
				if( ! in_array($prop, $this->relations) )
				{
					$this->relations[] = trim($prop);
				}
			}
		}

		if($this instanceof Collection)
		{
			foreach ($this->data as $model)
			{
				$model->addRelations($this->relations);
			}
		}
	}
816823
public function addEagerConstraints(array $models)
    {
        $table = $this->parent->getTable();

        $this->query->whereIn($table .'.' .$this->firstKey, $this->getKeys($models, $this->localKey));
    }
702424
protected function getQueryResults(array $models) {
        if (empty($this->relations)) {
            return static::getRelationQuery($models)->all();
        }
        $data = static::getRelationQuery($models)->appendSelect($this->getRelationFields())->all();
        if (empty($data)) {
            return $data;
        }
        foreach ($this->relations as $relation) {
            if (empty($relation->getKey())) {
                return $relation->getResults($data);
            }
            $data = $relation->getResults($data);
        }
        return $data;
    }
1005422
public function update($models)
    {
        if (! $this->shouldMaintainIndex($models->first())) {
            return;
        }

        foreach ($models as $model) {
            $this->performUpdate($model);
        }
    }
1146008
public function setExtraModelValues(array $fields, &$model)
    {
        //make sure the relationships are loaded
        foreach ($fields as $name => $field) {
            if ($field->getOption('relationship')) {
                $this->setModelRelationship($model, $field);
            }

            //if this is a setter field, unset it
            if ($field->getOption('setter')) {
                $model->__unset($name);
            }
        }
    }
827950
public function syncRelationships(array $relationships)
    {
        foreach ($relationships as $relation) {
            if (in_array($relation, $this->needSync)) {
                $this->synchronize($relation);
            }
        }
    }
859790
public function addConstraints()
    {
        $this->query->where($this->foreignKey, '=', $this->parent->{$this->localKey});
    }
1057332
def add_eager_constraints(self, models):
        
        super(MorphOneOrMany, self).add_eager_constraints(models)

        self._query.where(self._morph_type, self._morph_class)