diff --git a/CHANGELOG.md b/CHANGELOG.md index ccb61b5..edc24ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ +## 0.4.2 - 2017-05-12 + +### Changed +* Nothing + +### Added +* Nothing + +### Deprecated +* Nothing + +### Removed +* Nothing + +### Fixed +* fixed issue [#12](https://github.com/dotkernel/dot-mapper/issues/12) - error when saving multiple new entities + + ## 0.4.1 - 2017-05-02 ### Changed diff --git a/src/Mapper/AbstractDbMapper.php b/src/Mapper/AbstractDbMapper.php index b60e7a8..61e589c 100644 --- a/src/Mapper/AbstractDbMapper.php +++ b/src/Mapper/AbstractDbMapper.php @@ -300,9 +300,8 @@ protected function processSave(EntityInterface $entity, array $options) $primaryKey = array_intersect_key($data, array_flip($primaryColumns)); $primaryKey = array_filter($primaryKey); - $mapKey = implode(',', $primaryKey); - $isNew = empty($primaryKey) && !isset($this->identityMap[$mapKey]); + $isNew = empty($primaryKey); /** @var ResponseCollection $event */ $event = $this->dispatchEvent( @@ -329,6 +328,8 @@ protected function processSave(EntityInterface $entity, array $options) } if ($success && $isNew) { + $primaryKey = $entity->extractProperties($primaryColumns); + $mapKey = implode(',', $primaryKey); $this->identityMap[$mapKey] = $entity; }