Skip to content

Commit 89de166

Browse files
authored
Update Entity.php
1 parent c4abc43 commit 89de166

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

system/Entity.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,12 @@ public function __get(string $key)
295295
$result = $this->castAs($result, $this->_options['casts'][$key]);
296296
}
297297

298-
if(isset($result) && $result !== null)
298+
if(! isset($result) && ! property_exists($this, $key))
299299
{
300-
return $result;
300+
throw EntityException::forTryingToAccessNonExistentProperty($key, __CLASS__);
301301
}
302302

303-
throw EntityException::forTryingToAccessNonExistentProperty($key, __CLASS__);
303+
return $result;
304304

305305
}
306306

0 commit comments

Comments
 (0)