Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Commit

Permalink
Fix a potential variable overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
Alban Jubert committed Aug 13, 2018
1 parent cd14cbc commit 18ae1c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
4 changes: 2 additions & 2 deletions src/SaveRelationsBehavior.php
Expand Up @@ -215,9 +215,9 @@ private function _getRelatedFks($data, $relation, $modelClass)
if (isset($data[$modelAttribute])) {
$fks[$modelAttribute] = $data[$modelAttribute];
} elseif ($relation->multiple && !$relation->via) {
foreach ($link as $relatedAttribute => $modelAttribute) {
foreach ($link as $relatedAttribute => $relatedModelAttribute) {
if (!isset($data[$relatedAttribute])) {
$fks[$relatedAttribute] = $this->owner->{$modelAttribute};
$fks[$relatedAttribute] = $this->owner->{$relatedModelAttribute};
}
}
} else {
Expand Down

0 comments on commit 18ae1c8

Please sign in to comment.