diff --git a/system/Model.php b/system/Model.php index b9baeec5e3d3..4a8b9ce49727 100644 --- a/system/Model.php +++ b/system/Model.php @@ -1376,7 +1376,7 @@ protected function trigger(string $event, array $data) //-------------------------------------------------------------------- /** - * Provides/instantiates the builder/db connection. + * Provides/instantiates the builder/db connection and model's table/primary key names and return type. * * @param string $name * @@ -1384,7 +1384,11 @@ protected function trigger(string $event, array $data) */ public function __get(string $name) { - if (isset($this->db->$name)) + if(in_array($name, ['primaryKey', 'table', 'returnType'])) + { + return $this->{$name}; + } + elseif (isset($this->db->$name)) { return $this->db->$name; }