Skip to content

ReplayCycleDatabase

CycleDatabase, with CycleRecordingLogger installed on the Cycle\Database\DatabaseManager it builds.

Registered under the cycle driver alias by ReplayCyclePlugin in place of the plain CycleDatabase quioteframework/db-cycle’s own CyclePlugin registers.

Reads $this->resource directly rather than getCycleDatabaseManager() (which only promises Cycle\Database\DatabaseProviderInterface, with no setLogger()): the concrete Cycle\Database\DatabaseManager connect() builds also implements PSR-3’s LoggerAwareInterface, which is the contract this checks against instead of the concrete class.

Calling setLogger() after parent::connect() (rather than duplicating that method’s body) is safe: Cycle\Database\DatabaseManager::setLogger() re-applies the logger to every driver already initialized as well as every one created afterward, and connect() itself never resolves a driver — only new Cycle\Database\DatabaseManager(...)/new Cycle\ORM\ORM(...), neither of which touches an actual connection.

setLogger() is a whole-value assignment, so the recording logger CycleRecordingLogger::wrapping() composes with whatever the application had installed rather than replacing it. Installing this package must not silently end an application’s own Cycle query logging — the Eloquent adapter next door already gets this right by adding a listener alongside an existing dispatcher, and the two should not disagree.

final class ReplayCycleDatabase extends CycleDatabase

ExtendsCycleDatabase
SourceReplayCycleDatabase.php

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.
getConnection()DatabaseRetrieve the database connection associated with this Database implementation.
getCycleDatabaseManager()CycleDatabaseReturns Cycle’s own database manager, the DBAL layer beneath the ORM.
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.
getOrm()CycleDatabaseReturns the Cycle ORM instance, connecting on first use.
getParameter()ParameterHolderRetrieve a parameter.
getParameterNames()ParameterHolderRetrieve an array of parameter names.
getParameters()ParameterHolderRetrieve an array of parameters.
getPdo()CycleDatabaseCycle’s driver never exposes its underlying PDO/PDOInterface publicly (Driver::getPDO() is protected, and its return type isn’t even guaranteed to be \PDO).
getRepository()CycleDatabase
getResource()DatabaseRetrieve a raw database resource associated with this Database implementation.
hasParameter()ParameterHolderIndicates whether or not a parameter exists.
initialize()DatabaseInitialize this Database.
ping()CycleDatabaseProbes the connection with SELECT 1 through Cycle’s database manager.
removeParameter()ParameterHolderRemove a parameter.
reset()CycleDatabaseReturns this database to its pre-initialize() state, cleaning the ORM heap first.
setParameter()ParameterHolderSet a parameter.
setParameterByRef()ParameterHolderSet a parameter by reference.
setParameters()ParameterHolderSet an array of parameters.
setParametersByRef()ParameterHolderSet an array of parameters by reference.
shutdown()CycleDatabaseCleans the ORM heap and drops the ORM and DBAL resource.
startup()DatabaseDo any necessary startup work after initialization.