1
0
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:
Tristan Darricau
2021-11-09 02:48:34 +01:00
parent 300e5399f5
commit 6ce708539b
20 changed files with 941 additions and 385 deletions

View File

@@ -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);
}
}