prepare($query); $stmt->execute($params); return $stmt->fetchObject($output); } } abstract class BaseModel { protected static $sql; public function __construct(ISqlBase $sql) { self::$sql = $sql; } public static function Get(int $id) { return ConnectionManager::Query( self::$sql->Get(), [], get_called_class()); } } class JobSql implements ISqlBase { public function Get(): string { return "Select * from jobs where id = :id"; } } class Job extends BaseModel { public function __construct() { parent::__construct( new JobSql() ); } } $dns = 'pgsql:host=localhost;port=5432;dbname=dynamic_dev;user=test;password=pas123'; ConnectionManager::Connect($dns); echo " "; echo Job::Get(10); echo " ";