Change isNewRecord flag on successful adding of record to arangodb
This commit is contained in:
parent
8bcf826c25
commit
6eb7e80dd3
|
@ -44,7 +44,11 @@ class ArangoModel extends \yii\base\model {
|
||||||
// добавляем запись
|
// добавляем запись
|
||||||
$this->_doc = Document::createFromArray($this->getAttributes());
|
$this->_doc = Document::createFromArray($this->getAttributes());
|
||||||
|
|
||||||
return intval(Yii::$app->arango->documentHandler()->add(static::class_to_collection(get_called_class()), $this->_doc)) > 0;
|
$result = intval(Yii::$app->arango->documentHandler()->add(static::class_to_collection(get_called_class()), $this->_doc)) > 0;
|
||||||
|
if ($result) {
|
||||||
|
$this->_isNewRecord = false;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
} else {
|
} else {
|
||||||
// патчим!
|
// патчим!
|
||||||
$doc_attributes = array_keys($this->_doc->getAll());
|
$doc_attributes = array_keys($this->_doc->getAll());
|
||||||
|
|
Loading…
Reference in New Issue