Change isNewRecord flag on successful adding of record to arangodb

This commit is contained in:
bethrezen 2014-06-16 15:13:22 +04:00
parent 8bcf826c25
commit 6eb7e80dd3

View File

@ -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());