diff --git a/CHANGELOG.md b/CHANGELOG.md index edc24ba..6e82b83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ +## 0.4.3 - 2017-09-15 + +### Changed +* Nothing + +### Added +* array_filter on data before saving. Can be overridden with `force_nulls` option + +### Deprecated +* Nothing + +### Removed +* Nothing + +### Fixed +* Nothing + + ## 0.4.2 - 2017-05-12 ### Changed diff --git a/src/Mapper/AbstractDbMapper.php b/src/Mapper/AbstractDbMapper.php index 61e589c..4049d10 100644 --- a/src/Mapper/AbstractDbMapper.php +++ b/src/Mapper/AbstractDbMapper.php @@ -313,6 +313,11 @@ protected function processSave(EntityInterface $entity, array $options) return $event->last(); } + $forceNulls = (bool) $options['force_nulls'] ?? false; + if (!$forceNulls) { + $data = array_filter($data); + } + if ($isNew) { $success = $this->insert($entity, $data); } else {