From 4a2ebb333d239b58c19d09ee88646fa0e32e71ed Mon Sep 17 00:00:00 2001 From: wei <> Date: Mon, 16 Apr 2007 02:02:27 +0000 Subject: Updates to db stuff, removed js build from build.xml (no longer necessary) --- .../Data/ActiveRecord/TActiveRecordManager.php | 66 +++------------------- 1 file changed, 8 insertions(+), 58 deletions(-) (limited to 'framework/Data/ActiveRecord/TActiveRecordManager.php') diff --git a/framework/Data/ActiveRecord/TActiveRecordManager.php b/framework/Data/ActiveRecord/TActiveRecordManager.php index 5e463d2d..ab6fe88d 100644 --- a/framework/Data/ActiveRecord/TActiveRecordManager.php +++ b/framework/Data/ActiveRecord/TActiveRecordManager.php @@ -20,20 +20,16 @@ Prado::using('System.Data.ActiveRecord.TActiveRecordStateRegistry'); * 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 {@link createObjectStateRegistry()} method. - * Similarly, override {@link createRecordGateway()} for default gateway and override - * {@link 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 - * {@link DbConnection setDbConnection()} will use that connection. + * {@link DbConnection setDbConnection()} will use that connection unless + * the custom ActiveRecord class overrides the ActiveRecord::getDbConnection(). * - * The {@link onInsert()}, {@link onUpdate()}, - * {@link onDelete()} and {@link onSelect()} events are raised - * before their respective command are executed. + * Set the {@link setCache Cache} property to an ICache object to allow + * the active record gateway to cache the table meta data information. * * @author Wei Zhuo * @version $Id$ @@ -84,10 +80,12 @@ class TActiveRecordManager extends TComponent /** * @return TActiveRecordManager static instance of record manager. */ - public static function getInstance() + public static function getInstance($self=null) { static $instance; - if($instance===null) + if($self!==null) + $instance=$self; + else if($instance===null) $instance = new self; return $instance; } @@ -127,54 +125,6 @@ class TActiveRecordManager extends TComponent { return new TActiveRecordGateway($this); } - - /** - * 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. - * @param TActiveRecordEventParameter event parameter to be passed to the event handlers - */ - public function onInsert($param) - { - $this->raiseEvent('OnInsert', $this, $param); - } - - /** - * 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. - * @param TActiveRecordEventParameter event parameter to be passed to the event handlers - */ - public function onDelete($param) - { - $this->raiseEvent('OnDelete', $this, $param); - } - - /** - * 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. - * @param TActiveRecordEventParameter event parameter to be passed to the event handlers - */ - public function onUpdate($param) - { - $this->raiseEvent('OnUpdate', $this, $param); - } - - /** - * 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. - * @param TActiveRecordEventParameter event parameter to be passed to the event handlers - */ - public function onSelect($param) - { - $this->raiseEvent('OnSelect', $this, $param); - } } -- cgit v1.2.3