mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-17 12:28:41 +00:00
Simplify database type enum
This commit is contained in:
parent
b04f2f0577
commit
5f0c1b9a13
|
|
@ -101,7 +101,7 @@ abstract class ConnectionAbstract implements ConnectionInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getType() : int
|
||||
public function getType() : string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,12 +57,11 @@ class ConnectionFactory
|
|||
*/
|
||||
public static function create(array $dbdata) : ConnectionInterface
|
||||
{
|
||||
// todo: replace string with enum
|
||||
switch ($dbdata['db']) {
|
||||
case 'mysql':
|
||||
case DatabaseType::MYSQL:
|
||||
return new MysqlConnection($dbdata);
|
||||
break;
|
||||
case 'mssql':
|
||||
case DatabaseType::SQLSRV:
|
||||
return new SqlServerConnection($dbdata);
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ use phpOMS\Datatypes\Enum;
|
|||
*/
|
||||
abstract class DatabaseType extends Enum
|
||||
{
|
||||
/* public */ const MYSQL = 0; /* MySQL */
|
||||
/* public */ const SQLITE = 1; /* SQLITE */
|
||||
/* public */ const MYSQL = 'mysql'; /* MySQL */
|
||||
/* public */ const SQLITE = 'sqlite'; /* SQLITE */
|
||||
/* public */ const PGSQL = 2; /* PostgreSQL */
|
||||
/* public */ const ORACLE = 3; /* Oracle */
|
||||
/* public */ const SQLSRV = 4; /* Microsoft SQL Server */
|
||||
/* public */ const SQLSRV = 'mssql'; /* Microsoft SQL Server */
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user