AdapterFactory
in package
implements
FactoryInterface
Database utility class. May be used as a service or as a standard Laminas factory.
Tags
Interfaces, Classes, Traits and Enums
- FactoryInterface
Table of Contents
- $config : Config
- VuFind configuration
- __construct() : mixed
- Constructor
- __invoke() : object
- Create an object (glue code for FactoryInterface compliance)
- getAdapter() : Adapter
- Obtain a Laminas\DB connection using standard VuFind configuration.
- getAdapterFromConnectionString() : Adapter
- Obtain a Laminas\DB connection using a connection string.
- getAdapterFromOptions() : Adapter
- Obtain a Laminas\DB connection using an option array.
- getDriverName() : string
- Translate the connection string protocol into a driver name.
- getDriverOptions() : array<string|int, mixed>
- Get options for the selected driver.
Properties
$config
VuFind configuration
protected
Config
$config
Methods
__construct()
Constructor
public
__construct([Config $config = null ]) : mixed
Parameters
- $config : Config = null
-
VuFind configuration (provided when used as service; omitted when used as factory)
Return values
mixed —__invoke()
Create an object (glue code for FactoryInterface compliance)
public
__invoke(ContainerInterface $container, string $requestedName[, null|array<string|int, mixed> $options = null ]) : object
Parameters
- $container : ContainerInterface
-
Service manager
- $requestedName : string
-
Service being created
- $options : null|array<string|int, mixed> = null
-
Extra options (optional)
Tags
Return values
object —getAdapter()
Obtain a Laminas\DB connection using standard VuFind configuration.
public
getAdapter([string $overrideUser = null ][, string $overridePass = null ]) : Adapter
Parameters
- $overrideUser : string = null
-
Username override (leave null to use username from config.ini)
- $overridePass : string = null
-
Password override (leave null to use password from config.ini)
Return values
Adapter —getAdapterFromConnectionString()
Obtain a Laminas\DB connection using a connection string.
public
getAdapterFromConnectionString(string $connectionString[, string $overrideUser = null ][, string $overridePass = null ]) : Adapter
Parameters
- $connectionString : string
-
Connection string of the form [db_type]://[username]:[password]@[host]/[db_name]
- $overrideUser : string = null
-
Username override (leave null to use username from connection string)
- $overridePass : string = null
-
Password override (leave null to use password from connection string)
Return values
Adapter —getAdapterFromOptions()
Obtain a Laminas\DB connection using an option array.
public
getAdapterFromOptions(array<string|int, mixed> $options) : Adapter
Parameters
- $options : array<string|int, mixed>
-
Options for building adapter
Return values
Adapter —getDriverName()
Translate the connection string protocol into a driver name.
public
getDriverName(string $type) : string
Parameters
- $type : string
-
Database type from connection string
Return values
string —getDriverOptions()
Get options for the selected driver.
protected
getDriverOptions(string $driver) : array<string|int, mixed>
Parameters
- $driver : string
-
Driver name