This commit is contained in:
Michał Sieciechowicz 2021-02-26 22:08:57 +01:00
parent f7e35dee68
commit 49760a09bf
1 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@ interface ISqlBase {
//public function Delete(): string;
}
class BaseModel {
abstract class BaseModel {
protected $sql;
public function __construct(ISqlBase $sql) {
@ -15,7 +15,7 @@ class BaseModel {
}
public static function Get(int $id) {
return self::class;
return get_class($this);
$stmt = $pdo->prepare('SELECT id, name FROM users WHERE id=?');
$stmt->execute([$id]);
return $stmt->fetchObject(__CLASS__);