Skip to content

Commit e81f806

Browse files
authored
Update Entity.php
1 parent fdf2e7b commit e81f806

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

system/Entity.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,14 @@ public function __get(string $key)
294294
{
295295
$result = $this->castAs($result, $this->_options['casts'][$key]);
296296
}
297+
298+
if(isset($result) && $result !== null)
299+
{
300+
return $result;
301+
}
302+
303+
throw EntityException::forTryingToAccessNonExistentProperty($key, __CLASS__);
297304

298-
return $result;
299305
}
300306

301307
//--------------------------------------------------------------------

0 commit comments

Comments
 (0)