From 60d208e3a3c7688d78a9235bff555dc948468d11 Mon Sep 17 00:00:00 2001 From: kitchenu Date: Thu, 4 May 2017 19:12:50 +0900 Subject: [PATCH] Fix hasMany relations saving --- lib/Relation/HasMany.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Relation/HasMany.php b/lib/Relation/HasMany.php index 7643b8a..0366b15 100644 --- a/lib/Relation/HasMany.php +++ b/lib/Relation/HasMany.php @@ -114,7 +114,7 @@ public function save(EntityInterface $entity, $relationName, $options = []) } foreach ($oldEntities as $oldRelatedEntity) { - if (!in_array($oldRelatedEntity, $relatedIds)) { + if (!in_array($oldRelatedEntity->primaryKey(), $relatedIds)) { $deletedIds[] = $oldRelatedEntity->primaryKey(); } }