From 6eb7e80dd3ece462e29617adb01a7fc15d5b5b15 Mon Sep 17 00:00:00 2001 From: bethrezen Date: Mon, 16 Jun 2014 15:13:22 +0400 Subject: [PATCH] Change isNewRecord flag on successful adding of record to arangodb --- ArangoModel.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ArangoModel.php b/ArangoModel.php index 73e8dff..c7a84d0 100644 --- a/ArangoModel.php +++ b/ArangoModel.php @@ -44,7 +44,11 @@ class ArangoModel extends \yii\base\model { // добавляем запись $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 { // патчим! $doc_attributes = array_keys($this->_doc->getAll());