From 94ba7f6fdbe4ae93a8d86608c5e36592ca2635ac Mon Sep 17 00:00:00 2001 From: "Paul M. Jones" Date: Thu, 12 Jul 2018 16:47:43 -0500 Subject: [PATCH] no need to check intersection, since Related::set() already skips invalid fields --- src/MapperRelationships.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/MapperRelationships.php b/src/MapperRelationships.php index 0ed8efb..3831fe4 100644 --- a/src/MapperRelationships.php +++ b/src/MapperRelationships.php @@ -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; }