diff --git a/src/PhalconRest/Transformers/ModelTransformer.php b/src/PhalconRest/Transformers/ModelTransformer.php index 44a9708..30f261a 100644 --- a/src/PhalconRest/Transformers/ModelTransformer.php +++ b/src/PhalconRest/Transformers/ModelTransformer.php @@ -34,6 +34,11 @@ public function transform($item) foreach ($this->getResponseProperties() as $property) { $fieldName = array_key_exists($property, $keyMap) ? $keyMap[$property] : $property; + + if( !property_exists($item,$fieldName) ) { + continue; + } + $result[$fieldName] = $this->getFieldValue($item, $property, $fieldName); }