mirror of
https://github.com/standardebooks/web.git
synced 2025-07-10 00:30:28 -04:00
Add auto-detected types from DB in ORM
This commit is contained in:
parent
7a11cacf6d
commit
58c0d301dd
3 changed files with 67 additions and 17 deletions
|
@ -9,15 +9,7 @@ abstract class OrmBase{
|
|||
|
||||
public static function FillObject(Object $object, array $row): Object{
|
||||
foreach($row as $property => $value){
|
||||
if(substr($property, strlen($property) - 9) == 'Timestamp'){
|
||||
if($value !== null){
|
||||
$object->$property = new DateTime($value, new DateTimeZone('UTC'));
|
||||
}
|
||||
else{
|
||||
$object->$property = null;
|
||||
}
|
||||
}
|
||||
elseif(substr($property, strlen($property) - 5) == 'Cache'){
|
||||
if(substr($property, strlen($property) - 5) == 'Cache'){
|
||||
$property = substr($property, 0, strlen($property) - 5);
|
||||
$object->$property = $value;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue