mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-22 16:22:58 +02:00
[ticket/16741] General fixes
PHPBB3-16741
This commit is contained in:
@@ -13,32 +13,18 @@
|
||||
|
||||
namespace phpbb\db\tools;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
|
||||
/**
|
||||
* A factory which serves the suitable tools instance for the given dbal
|
||||
*/
|
||||
class factory
|
||||
{
|
||||
/**
|
||||
* @param mixed $db_driver
|
||||
* @param bool $return_statements
|
||||
* @return \phpbb\db\tools\tools_interface
|
||||
* @return tools_interface
|
||||
*/
|
||||
public function get($db_driver, $return_statements = false)
|
||||
public function get(Connection $connection, $return_statements = false)
|
||||
{
|
||||
// @todo: only create the doctrine tools object.
|
||||
if ($db_driver instanceof \phpbb\db\driver\mssql_base)
|
||||
{
|
||||
return new \phpbb\db\tools\mssql($db_driver, $return_statements);
|
||||
}
|
||||
else if ($db_driver instanceof \phpbb\db\driver\postgres)
|
||||
{
|
||||
return new \phpbb\db\tools\postgres($db_driver, $return_statements);
|
||||
}
|
||||
else if ($db_driver instanceof \phpbb\db\driver\driver_interface)
|
||||
{
|
||||
return new \phpbb\db\tools\tools($db_driver, $return_statements);
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException('Invalid database driver given');
|
||||
return new doctrine($connection, $return_statements);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user