remove update remove methods

This commit is contained in:
evgen-d 2014-08-08 08:55:42 +04:00
parent c0dbd87f7a
commit 9f1dea1740

View File

@ -81,58 +81,6 @@ class Query extends Component implements QueryInterface
return $this->getStatement($options, $db);
}
public function update($collection, $columns, $condition, $params)
{
$clauses = [
$this->buildFrom($collection),
$this->buildWhere($condition, $params),
$this->buildUpdate($collection, $columns),
];
$aql = implode($this->separator, array_filter($clauses));
$options = ArrayHelper::merge(
$params,
[
'query' => $aql,
'bindVars' => $params,
]
);
return $this->getStatement($options);
}
public function remove($collection, $condition, $params)
{
$clauses = [
$this->buildFrom($collection),
$this->buildWhere($condition, $params),
$this->buildRemove($collection),
];
$aql = implode($this->separator, array_filter($clauses));
$options = ArrayHelper::merge(
$params,
[
'query' => $aql,
'bindVars' => $params,
]
);
return $this->getStatement($options);
}
protected function buildUpdate($collection, $columns)
{
return 'UPDATE ' . $collection . 'WITH ' . Json::encode($columns) . ' IN ' . $collection;
}
protected function buildRemove($collection)
{
return 'REMOVE ' . $collection . ' IN ' . $collection;
}
/**
* @param $fields
* @return $this