Db
in package
Db Class
Database connection handler
Tags
Table of Contents
Properties
- $adodb : ADONewConnection
- AdoDB instance
- $cacheDriver : mixed
- doctrine cache driver instance
- $db : mixed
- $dbUser : mixed
- $em : EntityManager
- Doctrine entity manager instance
- $loggableListener : LoggableListener
- Doctrine LoggableListener instance
- $pdo : PDO
- PDO instance
- $translationListener : TranslationListener
Methods
- __construct() : mixed
- Creates a new instance of the database connection handler
- addSchemaFileDirectories() : mixed
- Adds YAML directories to entity manager
- fromExistingConnection() : Db
- Creates a new instance by using an existing database connection
- getAdoDb() : ADONewConnection
- Returns the AdoDB connection
- getDb() : Db
- Returns the database info object
- getEntityManager() : EntityManager
- Returns the doctrine entity manager
- getLoggableListener() : LoggableListener
- Returns the LoggableListener in use
- getPdoConnection() : PDO
- Initializes the PDO connection
- getTranslationListener() : TranslationListener
- Return the TranslationListener
- setAdoDb() : mixed
- Sets the AdoDB connection
- setEntityManager() : mixed
- Bind initialized Entity Manager
- setPdoConnection() : mixed
- Bind initialized PDO connection
- setUsername() : mixed
- Sets the username for loggable listener
Properties
$adodb
AdoDB instance
protected
ADONewConnection
$adodb
= null
$cacheDriver
doctrine cache driver instance
protected
mixed
$cacheDriver
$db
protected
mixed
$db
$dbUser
protected
mixed
$dbUser
$em
Doctrine entity manager instance
protected
EntityManager
$em
= null
$loggableListener
Doctrine LoggableListener instance
protected
LoggableListener
$loggableListener
= null
$pdo
PDO instance
protected
PDO
$pdo
= null
$translationListener
protected
TranslationListener
$translationListener
= null
Methods
__construct()
Creates a new instance of the database connection handler
public
__construct(Db $db, DbUser $dbUser, mixed $cacheDriver) : mixed
Parameters
addSchemaFileDirectories()
Adds YAML directories to entity manager
public
addSchemaFileDirectories(array<string|int, mixed> $paths) : mixed
Parameters
- $paths : array<string|int, mixed>
-
List of paths
fromExistingConnection()
Creates a new instance by using an existing database connection
public
static fromExistingConnection(Db $dbInfo, DbUser $dbUser, PDO $pdo, ADONewConnection $adoDb, EntityManager $em) : Db
Parameters
- $dbInfo : Db
- $dbUser : DbUser
- $pdo : PDO
-
Existing PDO connection
- $adoDb : ADONewConnection
-
Existing AdoDb connection based on $pdo
- $em : EntityManager
-
Existing Entity Manager object based on $pdo
Return values
Db —$dbInfo Database connection infos
getAdoDb()
Returns the AdoDB connection
public
getAdoDb() : ADONewConnection
Tags
Return values
ADONewConnectiongetDb()
Returns the database info object
public
getDb() : Db
Return values
Db —Database info object
getEntityManager()
Returns the doctrine entity manager
public
getEntityManager() : EntityManager
Return values
EntityManagergetLoggableListener()
Returns the LoggableListener in use
public
getLoggableListener() : LoggableListener
Return values
LoggableListener —Current loggable listener
getPdoConnection()
Initializes the PDO connection
public
getPdoConnection() : PDO
Return values
PDO —PDO connection
getTranslationListener()
Return the TranslationListener
public
getTranslationListener() : TranslationListener
Tags
Return values
TranslationListenersetAdoDb()
Sets the AdoDB connection
public
setAdoDb(ADONewConnection $adoDb) : mixed
Parameters
- $adoDb : ADONewConnection
-
Initialized AdoDB connection to be used for legacy database queries.
setEntityManager()
Bind initialized Entity Manager
public
setEntityManager(EntityManager $em) : mixed
Parameters
- $em : EntityManager
-
Initialized Entity Manager to be used by doctrine.
setPdoConnection()
Bind initialized PDO connection
public
setPdoConnection(PDO $pdo) : mixed
Parameters
- $pdo : PDO
-
Initialized PDO connection to be used as database connection.
setUsername()
Sets the username for loggable listener
public
setUsername(string $username) : mixed
Parameters
- $username : string
-
Username data as string