Allow usage of bool types on the ORM.

This commit is contained in:
kj 2022-08-01 08:27:49 -04:00
parent 8d47e10d7a
commit 08d92a2b81

View File

@ -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;
}