From 38b65382ae347ef79b39c81ebf9e8a6eb5cf5f7f Mon Sep 17 00:00:00 2001 From: Robin de Graaf Date: Mon, 13 Apr 2020 12:36:27 +0000 Subject: [PATCH] Fix bug in toArrayWithoutEmptyValues --- CHANGELOG.md | 3 +++ src/AbstractEntity.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e472ba8..46b8071 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Parable PHP ORM +## 0.8.2 +- Fix bug in `toArrayWithoutEmptyValues()` where a value of `0` would be seen as an empty value. + ## 0.8.1 _Changes_ diff --git a/src/AbstractEntity.php b/src/AbstractEntity.php index 6e78d1e..5d10fd2 100644 --- a/src/AbstractEntity.php +++ b/src/AbstractEntity.php @@ -106,7 +106,7 @@ public function toArrayWithoutEmptyValues(): array $array = $this->toArray(); foreach ($array as $key => $value) { - if (empty($value)) { + if (empty($value) && $value !== 0) { unset($array[$key]); } }