TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
ConnectionPool Class Reference

Public Member Functions

 getConnectionForTable (string $tableName)
 
 getConnectionByName (string $connectionName)
 
 getQueryBuilderForTable (string $tableName)
 
 getConnectionNames ()
 
 getCustomDoctrineTypes ()
 

Public Attributes

const DEFAULT_CONNECTION_NAME = 'Default'
 

Protected Attributes

 $customDoctrineTypes
 

Static Protected Attributes

static $connections = []
 

Detailed Description

Manager that handles opening/retrieving database connections.

It's a facade to the actual Doctrine DBAL DriverManager that implements TYPO3 specific functionality like mapping individual tables to different database connections.

getConnectionForTable() is the only supported way to get a connection that honors the table mapping configuration.

Definition at line 39 of file ConnectionPool.php.

Member Function Documentation

getConnectionByName ( string  $connectionName)

Creates a connection object based on the specified identifier.

This method should only be used in edge cases. Use getConnectionForTable() so that the tablename<>databaseConnection mapping will be taken into account.

Parameters
string$connectionName
Returns
Connection
Exceptions
Doctrine

Definition at line 96 of file ConnectionPool.php.

References $GLOBALS.

Referenced by ConnectionPool\getConnectionForTable().

getConnectionForTable ( string  $tableName)

Creates a connection object based on the specified table name.

This is the official entry point to get a database connection to ensure that the mapping of table names to database connections is honored.

Parameters
string$tableName
Returns
Connection

Definition at line 68 of file ConnectionPool.php.

References $GLOBALS, and ConnectionPool\getConnectionByName().

Referenced by ConnectionPool\getQueryBuilderForTable().

getConnectionNames ( )

Returns an array containing the names of all currently configured connections.

This method should only be used in edge cases. Use getConnectionForTable() so that the tablename<>databaseConnection mapping will be taken into account.

Definition at line 211 of file ConnectionPool.php.

References $GLOBALS.

getCustomDoctrineTypes ( )

Returns the list of custom Doctrine data types implemented by TYPO3. This method is needed by the Schema parser to register the types as it does not require a database connection and thus the types don't get registered automatically.

Definition at line 225 of file ConnectionPool.php.

References ConnectionPool\$customDoctrineTypes.

getQueryBuilderForTable ( string  $tableName)

Returns the connection specific query builder object that can be used to build complex SQL queries using and object oriented approach.

Parameters
string$tableName
Returns
QueryBuilder

Definition at line 190 of file ConnectionPool.php.

References ConnectionPool\getConnectionForTable().

Member Data Documentation

$connections = []
staticprotected

Definition at line 49 of file ConnectionPool.php.

$customDoctrineTypes
protected
Initial value:
= [
EnumType::TYPE => EnumType::class

Definition at line 54 of file ConnectionPool.php.

Referenced by ConnectionPool\getCustomDoctrineTypes().