We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 53d6b7b + b24f07d commit 8a3d87dCopy full SHA for 8a3d87d
src/models/Edit.php
@@ -126,6 +126,13 @@ public function save()
126
$model->key = $this->keys[$modelId];
127
$model->value = $this->values[$modelId];
128
129
+ // save only if anything changed to prevent unnecessary validation and saving which can be expensive
130
+ // (eg. each less will be compiled while validate)
131
+ if (!$model->getIsNewRecord() && empty($model->getDirtyAttributes())) {
132
+ Yii::debug('Nothing changed in model id: ' . $model->id . ' -> continue', __METHOD__);
133
+ continue;
134
+ }
135
+
136
if ($model->save() === false) {
137
$transaction->rollBack();
138
return false;
0 commit comments