Skip to content

Commit

Permalink
Fix bug in toArrayWithoutEmptyValues
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin de Graaf committed Apr 13, 2020
1 parent 804543d commit 38b6538
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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_
Expand Down
2 changes: 1 addition & 1 deletion src/AbstractEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
Expand Down

0 comments on commit 38b6538

Please sign in to comment.