Skip to content

Commit

Permalink
no need to check intersection, since Related::set() already skips inv…
Browse files Browse the repository at this point in the history
…alid fields
  • Loading branch information
Paul M. Jones committed Jul 12, 2018
1 parent 454e3a0 commit 94ba7f6
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/MapperRelationships.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,8 @@ public function newRelated(array $fields = []) : Related
$this->prototypeRelated = new Related($this->fields);
}

$values = [];
$fields = array_intersect_key($fields, $this->fields);
foreach ($fields as $field => $value) {
$values[$field] = $value;
}

$newRelated = clone $this->prototypeRelated;
$newRelated->set($values);
$newRelated->set($fields);
return $newRelated;
}

Expand Down

0 comments on commit 94ba7f6

Please sign in to comment.