Set this query's lazy loaded relationships.

@param  query  $query
@return query
347149
public function setLazyLoaded($query)
	{
		if( ! empty($this->getLazyLoad()))
		{
			$query = $query->load($this->getLazyLoad());
		}

		return $query;
	}
8766
public function setQueries($queries)
    {
        $this->queries = [];
        if (!is_array($queries)) {
            $queries = [$queries];
        }
        foreach ($queries as $query) {
            $this->addQuery($query);
        }

        return $this;
    }
3192
public function setQuery($query)
    {
        if (is_string($query)) {
            $output = null;
            parse_str($query, $output);
            $this->query = new QueryString($output);
        } elseif (is_array($query)) {
            $this->query = new QueryString($query);
        } elseif ($query instanceof QueryString) {
            $this->query = $query;
        }

        return $this;
    }
1233065
public function quote(Query $query)
    {
        $binder = $query->getValueBinder();
        $query->setValueBinder(false);

        if ($query->type() === 'insert') {
            $this->_quoteInsert($query);
        } elseif ($query->type() === 'update') {
            $this->_quoteUpdate($query);
        } else {
            $this->_quoteParts($query);
        }

        $query->traverseExpressions([$this, 'quoteExpression']);
        $query->setValueBinder($binder);

        return $query;
    }
918917
public function setQuerystring(string $query = null) : self
    {
        if (is_null($query)) {
            $this->uri['query'] = [];
        } else {
            $this->uri['query'] = $this->parseStr($query);
        }

        return $this;
    }
672870
public function setQuery($query = null)
    {
        $this->query = [];
        return ($query === null)
            ? $this
            : $this->addQueryData($query);
    }
650380
protected function performJoin($query = null)
    {
        $query = $query ?: $this->query;

        // We need to join to the intermediate table on the related model's primary
        // key column with the intermediate table's foreign key for the related
        // model instance. Then we can set the "where" for the parent models.
        $baseTable = $this->related->getTable();

        $key = $baseTable.'.'.$this->related->getKeyName();

        $query->join($this->table, $key, '=', $this->getQualifiedRelatedKeyName());

        return $this;
    }
1307513
public function setQuery($queries)
    {
        if ($this->executed) {
            $this->clear();
        }
        $this->query->multiple()->setQuery($queries);

        return $this;
    }
490873
public static function createRequestForQuery(Query $query)
    {
        $request = new Message();
        $request->header->set('id', self::generateId());
        $request->header->set('rd', 1);
        $request->questions[] = (array) $query;
        $request->prepare();

        return $request;
    }
527978
public function mergeToQuery(Select $query)
    {
        foreach ($this->getSelect() as $key => $select) {
            $query->prependSelect([$key => $select]);
        }

        foreach ($this->getJoin() as $join) {
            $query->join($join, null, null, $this->getBinds('join'));
        }

        if ($groupBy = $this->getGroupBy()) {
            $query->groupBy($groupBy);
        }

        if (($having = $this->getHaving()) && $having->hasChildren()) {
            $query->having($having);
        }

        if ($orderBy = $this->getOrderBy()) {
            $query->orderBy($orderBy);
        }

        return $this;
    }
825572
protected function setKeysForSaveQuery(Builder $query)
    {
        if (isset($this->attributes[$this->getKeyName()])) {
            return parent::setKeysForSaveQuery($query);
        }

        $query->where($this->foreignKey, $this->getOriginal(
            $this->foreignKey, $this->getAttribute($this->foreignKey)
        ));

        return $query->where($this->relatedKey, $this->getOriginal(
            $this->relatedKey, $this->getAttribute($this->relatedKey)
        ));
    }
291184
public static function addRelationship($query, $relationship)
    {
        $property = $query->getRepository()->getDescription()->getProperty($relationship);

        switch (true) {
            case $property->isManyToOne() :
                return self::_parseManyToOne($query, $property);
            case $property->isManyToMany() :
                return self::_parseManyToMany($query, $property);
            case $property->isOneToMany() :
                return self::_parseOneToMany($query, $property);

        }
    }
486031
public function setQuery($query = null)
    {

        try {

            // need to return << true
            $this->validator->verify($query, ['isNotNull', 'isAcceptLength']);

            if (false === $this->exact) {
                $this->query = ['query' => '%' . $query . '%'];
            }
            else {
                $this->query = ['query' => $query];
            }

        }
        catch(ExceptionFactory $e) {
            echo $e->getMessage();
        }

        return $this;
    }
737314
protected function cloneQuery(Query $query)
    {
        $aclAppliedQuery = clone $query;
        $params = $query->getParameters();
        /* @var $param Parameter */
        foreach ($params as $param) {
            $aclAppliedQuery->setParameter($param->getName(), $param->getValue(), $param->getType());
        }

        return $aclAppliedQuery;
    }
1113273
public function setQuery($query)
    {
        $this->query = null;
        if (is_string($query)) {
            $this->query = ltrim($query, '?');
        }
        return $this;
    }
863901
public function addSubQuery(
        string $name,
        Query $query
    ): self {
        $this->subqueries[$name] = $query;

        return $this;
    }
394055
protected function getValueFromRelationQuery($query)
    {
        // Prevent looking up connected model when foreign keys are NULL to prevent query errors.

        /** @var MorphTo $query */
        $typeName = $query->getMorphType();
        $keyName  = $query->getForeignKey();

        if ( ! $this->model->{$typeName} || ! $this->model->{$keyName}) {
            return null;
        }

        $query = $this->prepareRelationQuery($query);

        return $this->getValueFromModel(
            $query->first()
        );
    }