@param string|array $query

@return \ManaPHP\Dom\SelectorList
334380
public function xpath($query)
    {
        $nodes = [];
        /**
         * @var \DOMNode $node
         */
        foreach ($this->_document->getQuery()->xpath($query, $this->_node) as $node) {
            $nodes[$node->getNodePath()] = $node;
        }
        return new SelectorList($this->_document, $nodes);
    }
903932
private function runQuery($query)
    {
        $resultSetMapping = (new ResultSetMapping())
                ->addScalarResult('id', 'id')
                ->addScalarResult('type', 'type')
                ->addScalarResult('date', 'date');
        
        return $this->em->createNativeQuery($query, $resultSetMapping)
                ->getArrayResult();
    }
846593
final protected function createSelectQuery(Query $query)
    {
        $select = $this->getDatabase()->select('node', 'n')->fields('n', ['nid'])->addTag('node_access');

        if ($this->addGroupby()) {
            $select->groupBy('n.nid');
        }

        return $select;
    }
1005762
public function query($query)
    {
        \Assert\that($query)->string()->notEmpty();

        $this->query = $query;

        return $this;
    }
1332824
public static function create($query)
    {
        switch (true) {
            case $query instanceof self:
                return $query;
            case $query instanceof AbstractQuery:
                return new self($query);
            case empty($query):
                return new self(new MatchAll());
            case \is_array($query):
                return new self($query);
            case \is_string($query):
                return new self(new QueryString($query));
            case $query instanceof AbstractSuggest:
                return new self(new Suggest($query));

            case $query instanceof Suggest:
                return new self($query);
        }

        throw new InvalidException('Unexpected argument to create a query for.');
    }
80386
public function addQuery($query)
    {
        $uri = clone $this;
        $query = is_array($query) ? http_build_query($query, PHP_QUERY_RFC3986) : $query;

        parse_str($query, $newQuery);

        if ( ! empty($uri->query)) {
            parse_str($uri->query, $oldQuery);
            $query = array_merge($oldQuery, $newQuery);
        } else {
            $query = $newQuery;
        }

        if (is_array($query)) {
            $uri->query = http_build_query($query, PHP_QUERY_RFC3986);
        }

        return $uri;
    }
300441
public function getSortColumns(array $query = [])
    {
        $current_sort_by = $this->getSortColumn($query);

        // sort by
        $sort_by = [];
        foreach (self::$sort_by_column as $column => $info) {
            $sort_by[] = [
                'name' => $info['name'],
                'title' => $info['title'],
                'current' => $current_sort_by == $column,
                'link' => '?'.http_build_query(
                    array_merge($query, ['sort_by' => $column])
                ),
            ];
        }

        return $sort_by;
    }
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;
    }
959631
public function makeQueryFiltered($query)
    {
        $settingTarget = $this->getSettingTarget();
        if ($settingTarget) {
            $query = $query->where([
                ['settable_id', '=', $settingTarget->getKeyName()],
                ['settable_type', '=', $settingTarget->getMorphClass()]
            ]);
        } else {
            $query = $query->whereNull('settable_id')->whereNull('settable_type');
        }
        return $query;
    }
413071
final public function queryArray(string $query)
    {
        $result = $this->queryResult($query);
        if (false === $result) {
            return false;
        }

        $return = [];
        while (false !== $row = $result->fetchRow()) {
            $return[] = $row;
        }
        return $return;
    }
418269
public function queryParams(array $query)
	{
		$this->query = Arrays::mergeDeep($this->query, $query);
		
		return $this;
	}
1316143
public function selectSub($query, $as)
	{
		// If the given query is a Closure, we will execute it while passing in a new
		// query instance to the Closure. This will give the developer a chance to
		// format and work with the query before we cast it to a raw SQL string.
		if ($query instanceof Closure)
		{
			$callback = $query;
			$callback($query = $this->newQuery());
		}

		// Here, we will parse this query into an SQL string and an array of bindings
		// so we can add it to the query builder using the selectRaw method so the
		// query is included in the real SQL generated by this builder instance.
		list($query, $bindings) = $this->parseSubSelect($query);

		return $this->selectRaw(
			'('.$query.') as '.$this->grammar->wrap($as), $bindings
		);
	}
873648
public function query($query = NULL) {
        if (isset($query)) {
            $this->setQuery(self::cleanQuery($query));
            return $this;
        }
        return $this->getQuery();
    }
1260595
public function setQueryString(array $query): self
    {

        foreach ($query as $key => $value) {
            if (is_array($value)) {
                $query[$key] = implode(',', $value);
            }
        }

        $this->query_string = array_merge($this->query_string, $query);

        return $this;
    }
612462
public function compileSelect(Builder $query)
    {
        if (is_null($query->columns)) $query->columns = array('*');

        return trim($this->concatenate($this->compileComponents($query)));
    }
831223
public static function plainSql($query)
    {
        $query = static::getBaseQuery($query);
        return self::inlineBindings($query->toSql(), $query->getBindings());
    }
230925
public function mergeToQuery(Select $query)
    {
        $query->join(
            $this->getKeyCondition(),
            $this->getQuery()->getWhere()->build(),
            null,
            $this->getQuery()->getBinds('where')
        );

        foreach ($this->select as $select) {
            $query->prependSelect($select);
        }

        foreach ($this->getQuery()->getSelect() as $key => $select) {
            $query->prependSelect([$key => $select]);
        }

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

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

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

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

        return $this;
    }