Исправление ошибки в genQuery()

This commit is contained in:
Arsen Mirzaev Tatyano-Muradovich 2021-04-11 03:30:56 +10:00
parent bb7b1b8f8e
commit eb5e18dfd6

View File

@ -820,22 +820,22 @@ class Query extends Component implements QueryInterface
{ {
// Инициализация // Инициализация
$query ?? $query = $this; $query ?? $query = $this;
$this->in ?? $this->in = $this->collection ?? throw new Exception('Не найдена коллекция'); $query->in ?? $query->in = $query->collection ?? throw new Exception('Не найдена коллекция');
$this->for ?? $this->for = $this->in; $query->for ?? $query->for = $query->in;
$this->collection ?? $this->collection = is_array($this->for) ? $this->in : $this->for; $query->collection ?? $query->collection = $query->in;
$params = array_merge($params, $query->params); $params = array_merge($params, $query->params);
$clauses = [ $clauses = [
static::genFor($query->for), $query::genFor($query->for),
static::genIn($query->in, $query->traversals), $query::genIn($query->in, $query->traversals),
static::genLet($query->lets), $query::genLet($query->lets),
$this->genForeach($query->foreach), $query->genForeach($query->foreach),
$this->genWhere($query->where, $params), $query->genWhere($query->where, $params),
isset($this->search) ? $this->genSearch($this->search, $this->searchType) : null, isset($query->search) ? $query->genSearch($query->search, $query->searchType) : null,
$this->genOrderBy($query->orderBy, $params), $query->genOrderBy($query->orderBy, $params),
$this->genLimit($query->limit, $query->offset, $params), $query->genLimit($query->limit, $query->offset, $params),
$this->genSelect($query->select, $params), $query->genSelect($query->select, $params),
]; ];
$aql = implode($query->separator, array_filter($clauses)); $aql = implode($query->separator, array_filter($clauses));
@ -928,8 +928,8 @@ class Query extends Component implements QueryInterface
public function insert($columns, $params = [], $db = null) public function insert($columns, $params = [], $db = null)
{ {
// Инициализация // Инициализация
$this->in ?? (isset($this->collection) ? $this->in = $this->collection : throw new Exception('Не найдена коллекция')); $this->in ?? $this->in = $this->collection ?? throw new Exception('Не найдена коллекция');
$this->collection ?? $this->collection = is_array($this->for) ? $this->in : $this->for; $this->collection ?? $this->collection = $this->in ;
$data = Serializer::encode($columns); $data = Serializer::encode($columns);
@ -976,7 +976,7 @@ class Query extends Component implements QueryInterface
// Инициализация // Инициализация
$this->in ?? $this->in = $this->collection ?? throw new Exception('Не найдена коллекция'); $this->in ?? $this->in = $this->collection ?? throw new Exception('Не найдена коллекция');
$this->for ?? $this->for = $this->in; $this->for ?? $this->for = $this->in;
$this->collection ?? $this->collection = is_array($this->for) ? $this->in : $this->for; $this->collection ?? $this->collection = $this->in;
$clauses = [ $clauses = [
static::genFor($this->for), static::genFor($this->for),
@ -1028,7 +1028,7 @@ class Query extends Component implements QueryInterface
// Инициализация // Инициализация
$this->in ?? $this->in = $this->collection ?? throw new Exception('Не найдена коллекция'); $this->in ?? $this->in = $this->collection ?? throw new Exception('Не найдена коллекция');
$this->for ?? $this->for = $this->in; $this->for ?? $this->for = $this->in;
$this->collection ?? $this->collection = is_array($this->for) ? $this->in : $this->for; $this->collection ?? $this->collection = $this->in;
$clauses = [ $clauses = [
static::genFor($this->for), static::genFor($this->for),