18 lines
457 B
PHP
18 lines
457 B
PHP
|
<?php
|
||
|
|
||
|
class MySqlTable extends Table
|
||
|
{
|
||
|
public function __construct(string $tableName, $id = null, DatabaseInterface &$database = null)
|
||
|
{
|
||
|
self::EnsureConnection($database);
|
||
|
|
||
|
parent::__construct($tableName, $id, $database);
|
||
|
}
|
||
|
|
||
|
public static function EnsureConnection(?DatabaseInterface & $database): void
|
||
|
{
|
||
|
if (!($database instanceof MySqlDatabase)) {
|
||
|
$database = new MySqlDatabase();
|
||
|
}
|
||
|
}
|
||
|
}
|