Skip to content

Commit

Permalink
Patch Encoded null value issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksagona committed Nov 15, 2023
1 parent 45b712f commit 6697177
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Record/Encoded.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function toArray(): array
$result = parent::toArray();

foreach ($result as $key => $value) {
if ($this->isEncodedColumn($key)) {
if (($this->isEncodedColumn($key)) && ($value !== null)) {
$result[$key] = $this->decodeValue($key, $value);
}
}
Expand Down Expand Up @@ -258,7 +258,7 @@ public function encode(array $columns): array
public function decode(array $columns): array
{
foreach ($columns as $key => $value) {
if ($this->isEncodedColumn($key)) {
if (($this->isEncodedColumn($key)) && ($value !== null)) {
$columns[$key] = $this->decodeValue($key, $value);
}
}
Expand Down Expand Up @@ -305,7 +305,7 @@ public function __get(string $name): mixed
{
$value = parent::__get($name);

if ($this->isEncodedColumn($name)) {
if (($this->isEncodedColumn($name)) && ($value !== null)) {
$value = $this->decodeValue($name, $value);
}

Expand Down

0 comments on commit 6697177

Please sign in to comment.