fix Model
This commit is contained in:
		
							parent
							
								
									9060e31a92
								
							
						
					
					
						commit
						f5faf4df93
					
				|  | @ -8,6 +8,7 @@ abstract class Model { | |||
|     protected static string $primaryKey = 'id'; | ||||
|     protected static ?string $table = null; | ||||
|     protected static ?IQuery $query = null; | ||||
|     private static array $queryModels = []; | ||||
| 
 | ||||
|     protected static array $fields = []; | ||||
| 
 | ||||
|  | @ -21,7 +22,7 @@ abstract class Model { | |||
|         } | ||||
|         return $array; | ||||
|     } | ||||
|      | ||||
| 
 | ||||
|     public static function Instance(object $object): static { | ||||
|         $obj = new static; | ||||
|         $params = get_object_vars($object); | ||||
|  | @ -32,7 +33,11 @@ abstract class Model { | |||
|     } | ||||
| 
 | ||||
|     protected static function QueryModel() { | ||||
|         return static::SetQueryModel(); | ||||
|         if (!isset(static::$queryModels[static::class])) | ||||
|         if (static::$query === null) { | ||||
|             static::$queryModels[static::class] = static::SetQueryModel(); | ||||
|         } | ||||
|         return static::$queryModels[static::class]; | ||||
|     } | ||||
| 
 | ||||
|     public static function GetTableName() { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue