diff --git a/src/Libs/Model.php b/src/Libs/Model.php index ce454ea..32b70f6 100644 --- a/src/Libs/Model.php +++ b/src/Libs/Model.php @@ -236,20 +236,20 @@ class Model { $properties = $reflection->getProperties(ReflectionProperty::IS_PUBLIC); $result = []; - foreach($properties as $property) { - $att = $property->name; - $result[$att] = isset($this->$att) - ? $this->$att : null; - } + foreach($properties as $property) + $result[$property->name] = isset($this->{$property->name}) + ? $this->{$property->name} : null; - foreach (static::$ignoreSave as $del) { + foreach (static::$ignoreSave as $del) unset($result[$del]); - } - foreach (static::$forceSave as $value) { + foreach (static::$forceSave as $value) $result[$value] = isset($this->$value) ? $this->$value: null; - } + + foreach ($result as $i => $property) + if (gettype($property) == 'boolean') + $result[$i] = $property ? '1' : '0'; return $result; }