diff --git a/src/Libs/ModelMySQL.php b/src/Libs/ModelMySQL.php index 90fae24..ed820cf 100644 --- a/src/Libs/ModelMySQL.php +++ b/src/Libs/ModelMySQL.php @@ -175,9 +175,16 @@ class ModelMySQL { * @return array * Contiene los atributos indexados del objeto actual. */ - private function getVars() { // Source: https://stackoverflow.com/questions/10009015/show-all-public-attributes-name-and-value-of-an-object - $get_vars_proxy = create_function('$obj', 'return get_object_vars($obj);'); - $result = $get_vars_proxy($this); + private function getVars() { + $reflection = new \ReflectionClass($this); + $properties = $reflection->getProperties(\ReflectionProperty::IS_PUBLIC); + $result = []; + + foreach($properties as $property) { + $att = $property->name; + $result[$att] = $this->$att; + } + foreach ($this->ignoreSave as $del) { unset($result[$del]); }