Skip to content

Commit

Permalink
Merge pull request #13 from dotkernel/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
n3vrax authored May 12, 2017
2 parents 0606f97 + 2addbcd commit 08e6aa7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/Mapper/AbstractDbMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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;
}

Expand Down

0 comments on commit 08e6aa7

Please sign in to comment.