2020-08-17 23:46:58 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class MySqlTable extends Table
|
|
|
|
{
|
2020-08-23 12:37:39 +02:00
|
|
|
public function __construct(string $tableName, $id = null, DatabaseInterface &$database = null)
|
|
|
|
{
|
|
|
|
self::EnsureConnection($database);
|
2020-08-17 23:46:58 +02:00
|
|
|
|
2020-08-23 12:37:39 +02:00
|
|
|
parent::__construct($tableName, $id, $database);
|
|
|
|
}
|
2020-08-17 23:46:58 +02:00
|
|
|
|
2020-08-23 12:37:39 +02:00
|
|
|
public static function EnsureConnection(?DatabaseInterface & $database): void
|
|
|
|
{
|
|
|
|
if (!($database instanceof MySqlDatabase)) {
|
|
|
|
$database = new MySqlDatabase();
|
|
|
|
}
|
|
|
|
}
|
2020-08-17 23:46:58 +02:00
|
|
|
}
|