Skip to content

PropulsionDatabase

First-class adapter for Propulsion (the quioteframework/propulsion fork of Propel 1).

The adapter bootstraps Propulsion from its runtime config and returns a datasource PDO connection from PropulsionDatabase::getConnection().

Configuration parameters (in databases.xml): - config : path to the Propulsion runtime config file - datasource : datasource to use (default = config default) - overrides : key/value overrides applied after init - init_queries : extra connection init queries to append - enable_instance_pooling : true/false to force pooling behavior

class PropulsionDatabase extends Database

ExtendsDatabase
SourcePropulsionDatabase.php
MethodDescription
getConfigPath(): stringReturns the config parameter as configured.
getConnection(): mixedResolves the connection from Propulsion on every call instead of trusting the base class’s connect-once cache.
getDatasource(): stringReturns the Propulsion datasource this database connects through.
getPdo(): PDOReturns the datasource connection as a plain PDO handle.
getPropulsionConnection(): PropulsionPDOReturns the connection narrowed to Propulsion’s own PDO subclass.
getResource(): mixedRetrieve a raw database resource associated with this Database implementation.
initialize(DatabaseManager $databaseManager, array<string, mixed> $parameters = []): voidInitialize this Database.
ping(): boolProbes the connection with SELECT 1.
reset(): voidReturns this database to its pre-initialize() state, dropping Propulsion’s request-scoped session first.
shutdown(): mixedCloses Propulsion and drops the connection.

public function getConfigPath(): string

Returns the config parameter as configured.

This is the raw parameter value, not the directive-expanded path that initialize() actually loaded.

Returns string

ThrowsWhen
DatabaseExceptionIf the config parameter is absent or not a non-empty string.

public function getConnection(): mixed

Resolves the connection from Propulsion on every call instead of trusting the base class’s connect-once cache.

Propulsion::initialize() can drop its pooled connections underneath this adapter (see PropulsionDatabase::initialize()’s reconfiguration branch), which empties Propulsion’s own connection map without touching $this->connection. If that cached handle were returned here, this adapter and the ORM acting through Propulsion would silently operate on two different backends — e.g. a lock taken through this handle would never be visible to a write Propulsion itself performs. Propulsion::getConnection() is a pooled map lookup, so re-resolving on every call costs nothing and can never go stale.

Returns mixed

ThrowsWhen
DatabaseExceptionIf a connection could not be created.

public function getDatasource(): string

Returns the Propulsion datasource this database connects through.

Resolved during initialize() from the datasource parameter or from the config file’s default datasource; default until then.

Returns string

public function getPdo(): PDO

Returns the datasource connection as a plain PDO handle.

PropulsionPDO is an interface, and each concrete implementation extends the driver-specific PDO subclass rather than PDO itself, so the PDO instance is checked for here instead of being taken on trust.

Returns PDO

ThrowsWhen
DatabaseExceptionIf the connection could not be created, is not a PropulsionPDO, or is a PropulsionPDO that does not extend PDO.

public function getPropulsionConnection(): PropulsionPDO

Returns the connection narrowed to Propulsion’s own PDO subclass.

Connects lazily on first call. Use this over getConnection() when the caller needs Propulsion-specific PDO behaviour.

Returns PropulsionPDO

ThrowsWhen
DatabaseExceptionIf a connection could not be created, or the datasource handed back something that is not a PropulsionPDO.

public function getResource(): mixed

Retrieve a raw database resource associated with this Database implementation.

Returns mixed — A database resource.

ThrowsWhen
DatabaseExceptionIf a connection could not be created.

public function initialize(DatabaseManager $databaseManager, array<string, mixed> $parameters = []): void

Initialize this Database.

An assoc array of initialization params.

ParameterTypeDescription
$databaseManagerDatabaseManagerThe database manager of this instance.
$parametersarray``<``string``, ``mixed``>An assoc array of initialization params.
ThrowsWhen
InitializationExceptionIf an error occurs while initializing this Database.

public function ping(): bool

Probes the connection with SELECT 1.

Returns true when no connection has been opened yet, since lazy connect will create a fresh one on first use. On any failure — including the connection not being a PDO instance — the connection and resource are cleared so the next getConnection() reconnects, and false is returned.

Returns bool

public function reset(): void

Returns this database to its pre-initialize() state, dropping Propulsion’s request-scoped session first.

That session (instance pool, unit-of-work state) lives on Propulsion itself rather than on this object, so the base teardown — which shuts the connection down and clears the parameters, the manager reference and the name — would leave it behind. Re-initialize() this instance before using it again.

ThrowsWhen
DatabaseExceptionIf shutting the connection down fails.

public function shutdown(): mixed

Closes Propulsion and drops the connection.

Propulsion::close() is only called when Propulsion was initialized; the connection and resource are cleared either way, so a later getConnection() opens a new one.

Returns mixed

These come from an ancestor and are documented where they are declared.

MethodDeclared inDescription
appendParameter()ParameterHolderAppend a parameter.
appendParameterByRef()ParameterHolderAppend a parameter by reference.
clearParameters()ParameterHolderClear all parameters associated with this request.
getDatabaseManager()DatabaseRetrieve the Database Manager instance for this implementation.
getFlatParameterNames()ParameterHolderRetrieve an array of flattened parameter names.
getName()DatabaseRetrieve the name of this database connection.
getParameter()ParameterHolderRetrieve a parameter.
getParameterNames()ParameterHolderRetrieve an array of parameter names.
getParameters()ParameterHolderRetrieve an array of parameters.
hasParameter()ParameterHolderIndicates whether or not a parameter exists.
removeParameter()ParameterHolderRemove a parameter.
setParameter()ParameterHolderSet a parameter.
setParameterByRef()ParameterHolderSet a parameter by reference.
setParameters()ParameterHolderSet an array of parameters.
setParametersByRef()ParameterHolderSet an array of parameters by reference.
startup()DatabaseDo any necessary startup work after initialization.