Skip to content

Commit

Permalink
Fix not deleted when hasMany relations saving
Browse files Browse the repository at this point in the history
  • Loading branch information
kitchenu committed Dec 13, 2017
1 parent 3a51dcd commit 8a65044
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Relation/HasMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8a65044

Please sign in to comment.