Browse Source

Fix nested relations save, on dirty attributes not present #57 (#58)

master
Konstantin Malinin 5 years ago committed by GitHub
parent
commit
cc6b35d472
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/SaveRelationsBehavior.php

2
src/SaveRelationsBehavior.php

@ -561,7 +561,7 @@ class SaveRelationsBehavior extends Behavior
} else { } else {
$existingRecords[] = $relationModel; $existingRecords[] = $relationModel;
} }
if (count($relationModel->dirtyAttributes)) { if (count($relationModel->dirtyAttributes) || count($this->_newRelationValue)) {
if ($relationModel->validate()) { if ($relationModel->validate()) {
$relationModel->save(); $relationModel->save();
} else { } else {

Loading…
Cancel
Save