Skip to content

Commit

Permalink
HasManyLocal: apply getInstance() method for also created records
Browse files Browse the repository at this point in the history
  • Loading branch information
sngrl committed May 20, 2021
1 parent 16d4f91 commit dfd2797
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Form/Related/Forms/HasManyLocal.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,11 @@ protected function createGroup($attributes, $old = false, $key = null): Group
}
$model = $attributes instanceof Model
? $attributes
: $this->safeCreateModel($this->getModelClassForElements(), $attributes);
: (
null != ($instanceModel = $this->getInstance())
? $this->safeFillModel(clone $instanceModel, $attributes)
: $this->safeCreateModel($this->getModelClassForElements(), $attributes)
);
$group = new Group($model);

if ($this->groupLabel) {
Expand Down

0 comments on commit dfd2797

Please sign in to comment.