From 51124218d5ab4af2a215420cb416126d9305f52f Mon Sep 17 00:00:00 2001 From: Aldarien Date: Fri, 9 Sep 2022 17:47:46 -0400 Subject: [PATCH] Check if value is set before serializing --- src/Alias/Model.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Alias/Model.php b/src/Alias/Model.php index 0555b70..406c064 100644 --- a/src/Alias/Model.php +++ b/src/Alias/Model.php @@ -79,6 +79,9 @@ abstract class Model implements ModelInterface continue; } $p = strtolower(str_replace('get', '', $method->getName())); + if (!isset($this->{$p})) { + continue; + } $output[$p] = $this->{$method->getName()}(); } return $output;