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