From 9060e31a92759ee395ea63b50743daf0d9bdd78c Mon Sep 17 00:00:00 2001 From: Sieciech Date: Sun, 24 Oct 2021 00:59:10 +0200 Subject: [PATCH] fix cast --- src/Fufle/ORM/Model.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Fufle/ORM/Model.php b/src/Fufle/ORM/Model.php index 69781b7..d7d1ea3 100644 --- a/src/Fufle/ORM/Model.php +++ b/src/Fufle/ORM/Model.php @@ -23,7 +23,12 @@ abstract class Model { } public static function Instance(object $object): static { - return $object; + $obj = new static; + $params = get_object_vars($object); + foreach ($params as $key => $value) { + $obj->{$key} = $value; + } + return $obj; } protected static function QueryModel() {