## Class TActiveRecordManager

Description

TActiveRecordManager provides the default DB connection, default object state registry, default active record gateway, and table meta data inspector.

You can provide a different registry by overriding the createObjectStateRegistry() method. Similarly, override createRecordGateway() for default gateway and override createMetaDataInspector()for meta data inspector.

The default connection can be set as follows:

     TActiveRecordManager::getInstance()->setDbConnection($conn);

All new active record created after setting the DbConnection will use that connection.

The onInsert(), onUpdate(), onDelete() and onSelect() events are raised before their respective command are executed.

- since: 3.1
- version: $Id: TActiveRecordManager.php 1578 2006-12-17 22:20:50Z wei $
- author: Wei Zhuo <weizho[at]gmail[dot]com>

Located in /Data/ActiveRecord/TActiveRecordManager.php (line 43)

    TComponent
       |
       --TActiveRecordManager

Method Summary
TDbMetaDataInspector createMetaDataInspector (TDbConnection $conn)
TActiveRecordStateRegistry createObjectStateRegistry ()
TActiveRecordGateway createRecordGateway ()
ICache getCache ()
TDbConnection getDbConnection ()
TActiveRecordManager getInstance ()
TActiveRecordStateRegistry getObjectStateRegistry ()
TActiveRecordGateway getRecordGateway ()
TDbMetaDataInspector getTableInspector (TDbConnection $conn)
void onDelete (TActiveRecordEventParameter $param)
void onInsert (TActiveRecordEventParameter $param)
void onSelect (TActiveRecordEventParameter $param)
void onUpdate (TActiveRecordEventParameter $param)
void setCache (ICache $value)
void setDbConnection (TDbConnection $conn)
Methods
createMetaDataInspector (line 150)

Create an instance of a database meta inspector corresponding to the given database vendor specified by the $driver parameter.

- return: table meta inspector
- access: protected

TDbMetaDataInspector createMetaDataInspector (TDbConnection $conn)

- TDbConnection $conn: database connection

createObjectStateRegistry (line 108)

- return: default object registry.
- access: protected

TActiveRecordStateRegistry createObjectStateRegistry ()
createRecordGateway (line 126)

- return: default record gateway.
- access: protected

TActiveRecordGateway createRecordGateway ()
getCache (line 55)

- return: application cache.
- access: public

ICache getCache ()
getDbConnection (line 79)

- return: default database connection
- access: public

TDbConnection getDbConnection ()
getInstance (line 87)

- return: static instance of record manager.
- static:
- access: public

TActiveRecordManager getInstance ()
getObjectStateRegistry (line 98)

- return: record object registry.
- access: public

TActiveRecordStateRegistry getObjectStateRegistry ()
getRecordGateway (line 116)

- return: record gateway.
- access: public

TActiveRecordGateway getRecordGateway ()
getTableInspector (line 136)

Get table meta data for particular database and table.

- return: table meta inspector
- access: public

TDbMetaDataInspector getTableInspector (TDbConnection $conn)

- TDbConnection $conn: database connection.

onDelete (line 192)

This method is invoked before the object is deleted from the database.

The method raises 'OnDelete' event. If you override this method, be sure to call the parent implementation so that the event handlers can be invoked.

- access: public

void onDelete (TActiveRecordEventParameter $param)

- TActiveRecordEventParameter $param: event parameter to be passed to the event handlers

onInsert (line 180)

This method is invoked before the object is inserted into the database.

The method raises 'OnInsert' event. If you override this method, be sure to call the parent implementation so that the event handlers can be invoked.

- access: public

void onInsert (TActiveRecordEventParameter $param)

- TActiveRecordEventParameter $param: event parameter to be passed to the event handlers

onSelect (line 216)

This method is invoked before any select query is executed on the database.

The method raises 'OnSelect' event. If you override this method, be sure to call the parent implementation so that the event handlers can be invoked.

- access: public

void onSelect (TActiveRecordEventParameter $param)

- TActiveRecordEventParameter $param: event parameter to be passed to the event handlers

onUpdate (line 204)

This method is invoked before the object data is updated in the database.

The method raises 'OnUpdate' event. If you override this method, be sure to call the parent implementation so that the event handlers can be invoked.

- access: public

void onUpdate (TActiveRecordEventParameter $param)

- TActiveRecordEventParameter $param: event parameter to be passed to the event handlers

setCache (line 63)

- access: public

void setCache (ICache $value)

- ICache $value: application cache

setDbConnection (line 71)

- access: public

void setDbConnection (TDbConnection $conn)

- TDbConnection $conn: default database connection

#### Inherited Methods

Inherited From TComponent

> TComponent::addParsedObject()
> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::createdOnTemplate()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Documentation generated on Sun, 14 Jan 2007 21:41:01 -0500 by phpDocumentor 1.3.0RC4