From 9f3fef53fe46d014727baeb015820f3a41225657 Mon Sep 17 00:00:00 2001 From: Atanas Ginev Date: Mon, 30 Apr 2018 10:20:27 +0300 Subject: [PATCH] Fix chaining properties error: https://github.com/aginev/datagrid/issues/10 --- src/Rows/ModelRow.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Rows/ModelRow.php b/src/Rows/ModelRow.php index e5e67b8..9365d39 100644 --- a/src/Rows/ModelRow.php +++ b/src/Rows/ModelRow.php @@ -13,8 +13,13 @@ public function __get($key) { // The easiest way to chain the object properties foreach ($keys as $key) { - $value = $value->{$key}; - } + try { + $value = $value->{$key}; + } catch (\Exception $e) { + $value = ''; + break; + } + } return $value; }