summaryrefslogtreecommitdiff
path: root/framework/Data/ActiveRecord/TActiveRecordManager.php
diff options
context:
space:
mode:
authorGODZilla0480@gmail.com <>2011-08-28 05:51:36 +0000
committerGODZilla0480@gmail.com <>2011-08-28 05:51:36 +0000
commit5ad92b6fe39f04aad8d94f32d23c7e665725fe8c (patch)
treed4fe7c56be6e1b2c4becf136f3d3f2b3c2517049 /framework/Data/ActiveRecord/TActiveRecordManager.php
parentad5c394d39c35b48b7cfc4384288e53d268d0aab (diff)
Modify TActiveRecordConfig & TActiveRecordManager to allow custom subclassing of System.Data.ActiveRecord.TActiveRecordManager & System.Data.ActiveRecord.TActiveRecordGateway
Diffstat (limited to 'framework/Data/ActiveRecord/TActiveRecordManager.php')
-rw-r--r--framework/Data/ActiveRecord/TActiveRecordManager.php27
1 files changed, 26 insertions, 1 deletions
diff --git a/framework/Data/ActiveRecord/TActiveRecordManager.php b/framework/Data/ActiveRecord/TActiveRecordManager.php
index d39ef69e..1a1c1f37 100644
--- a/framework/Data/ActiveRecord/TActiveRecordManager.php
+++ b/framework/Data/ActiveRecord/TActiveRecordManager.php
@@ -37,6 +37,14 @@ Prado::using('System.Data.ActiveRecord.TActiveRecordGateway');
*/
class TActiveRecordManager extends TComponent
{
+ const DEFAULT_GATEWAY_CLASS = 'System.Data.ActiveRecord.TActiveRecordGateway';
+
+ /**
+ * Defaults to {@link TActiveRecordManager::DEFAULT_GATEWAY_CLASS DEFAULT_GATEWAY_CLASS}
+ * @var string
+ */
+ private $_gatewayClass = self::DEFAULT_GATEWAY_CLASS;
+
private $_gateway;
private $_meta=array();
private $_connection;
@@ -112,7 +120,24 @@ class TActiveRecordManager extends TComponent
*/
protected function createRecordGateway()
{
- return new TActiveRecordGateway($this);
+ return Prado::createComponent($this->getGatewayClass(), $this);
+ }
+
+ /**
+ * Set implementation class of ActiveRecordGateway
+ * @param string $value
+ */
+ public function setGatewayClass($value)
+ {
+ $this->_gatewayClass = (string)$value;
+ }
+
+ /**
+ * @return string the implementation class of ActiveRecordGateway. Defaults to {@link TActiveRecordManager::DEFAULT_GATEWAY_CLASS DEFAULT_GATEWAY_CLASS}
+ */
+ public function getGatewayClass()
+ {
+ return $this->_gatewayClass;
}
/**