From 8a6504436ead7cf38df273eaf11cb11625427ebe Mon Sep 17 00:00:00 2001 From: kitchenu Date: Wed, 13 Dec 2017 16:08:18 +0900 Subject: [PATCH] Fix not deleted when 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 0366b15..14232b1 100644 --- a/lib/Relation/HasMany.php +++ b/lib/Relation/HasMany.php @@ -122,7 +122,7 @@ public function save(EntityInterface $entity, $relationName, $options = []) if (count($deletedIds) || $relatedEntities === false) { $conditions = [$this->foreignKey() => $entity->primaryKey()]; if (count($deletedIds)) { - $conditions[$this->localKey().' :in'] = $deletedIds; + $conditions[$relatedMapper->primaryKeyField().' :in'] = $deletedIds; } if ($relatedMapper->entityManager()->fields()[$this->foreignKey()]['notnull']) { $relatedMapper->delete($conditions);