From 711b06c6d33be46e585f7da54aac5a7f4df87c4d Mon Sep 17 00:00:00 2001 From: David Molineus Date: Fri, 3 Jan 2020 08:43:21 +0100 Subject: [PATCH] Do not apply options which value is null --- CHANGELOG.md | 10 +++++++++- src/Mapper/OptionsBuilder.php | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e538c1..dad1d34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed + + - Do not add options which value is `NULL` + ## [3.1.5] - 2019-08-26 ### Fixed @@ -130,7 +136,9 @@ Implemented enhancements - Bypass filesystem cache in debug mode - Changelog added -[3.1.4]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.2...3.1.4 +[Unreleased]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.5...hotfix/3.1.6 +[3.1.5]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.4...3.1.5 +[3.1.4]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.3...3.1.4 [3.1.3]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.2...3.1.3 [3.1.1]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.0...3.1.1 [3.0.4]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.3...3.0.4 diff --git a/src/Mapper/OptionsBuilder.php b/src/Mapper/OptionsBuilder.php index 4d46d3c..c3035db 100644 --- a/src/Mapper/OptionsBuilder.php +++ b/src/Mapper/OptionsBuilder.php @@ -210,6 +210,10 @@ class OptionsBuilder foreach ($options as $option => $mapping) { $default = static::getDefaultOption($option, $definition); + if ($model->$mapping === null) { + continue; + } + if ($model->$mapping === '1' || $model->$mapping === '') { if (((bool) $model->$mapping) !== $default) { static::applyOption($option, $model->$mapping, $definition);