diff options
author | ctrlaltca <> | 2012-07-12 11:21:01 +0000 |
---|---|---|
committer | ctrlaltca <> | 2012-07-12 11:21:01 +0000 |
commit | 903ae8a581fac1e6917fc3e31d2ad8fb91df80c3 (patch) | |
tree | e08bf04f0823650a231227ac3499121270172a23 /framework/Data/ActiveRecord/TActiveRecordManager.php | |
parent | 3e4e6e66aeb3f8fea4e1eb4237498ef9d2358f63 (diff) |
standardize the use of unix eol; use svn properties to enforce native eol
Diffstat (limited to 'framework/Data/ActiveRecord/TActiveRecordManager.php')
-rw-r--r-- | framework/Data/ActiveRecord/TActiveRecordManager.php | 324 |
1 files changed, 162 insertions, 162 deletions
diff --git a/framework/Data/ActiveRecord/TActiveRecordManager.php b/framework/Data/ActiveRecord/TActiveRecordManager.php index 00979d1c..6cca76e7 100644 --- a/framework/Data/ActiveRecord/TActiveRecordManager.php +++ b/framework/Data/ActiveRecord/TActiveRecordManager.php @@ -1,163 +1,163 @@ -<?php
-/**
- * TActiveRecordManager class file.
- *
- * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
- * @link http://www.pradosoft.com/
+<?php +/** + * TActiveRecordManager class file. + * + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> + * @link http://www.pradosoft.com/ * @copyright Copyright © 2005-2012 PradoSoft - * @license http://www.pradosoft.com/license/
- * @version $Id$
- * @package System.Data.ActiveRecord
- */
-
-Prado::using('System.Data.TDbConnection');
-Prado::using('System.Data.ActiveRecord.TActiveRecord');
-Prado::using('System.Data.ActiveRecord.Exceptions.TActiveRecordException');
-Prado::using('System.Data.ActiveRecord.TActiveRecordGateway');
-
-/**
- * TActiveRecordManager provides the default DB connection,
- * default active record gateway, and table meta data inspector.
- *
- * The default connection can be set as follows:
- * <code>
- * TActiveRecordManager::getInstance()->setDbConnection($conn);
- * </code>
- * All new active record created after setting the
- * {@link DbConnection setDbConnection()} will use that connection unless
- * the custom ActiveRecord class overrides the ActiveRecord::getDbConnection().
- *
- * 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 <weizho[at]gmail[dot]com>
- * @version $Id$
- * @package System.Data.ActiveRecord
- * @since 3.1
- */
-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;
-
- private $_cache;
-
- /**
- * Defaults to '{@link TActiveRecordInvalidFinderResult::Null Null}'
- *
- * @var TActiveRecordInvalidFinderResult
- * @since 3.1.5
- */
- private $_invalidFinderResult = TActiveRecordInvalidFinderResult::Null;
-
- /**
- * @return ICache application cache.
- */
- public function getCache()
- {
- return $this->_cache;
- }
-
- /**
- * @param ICache application cache
- */
- public function setCache($value)
- {
- $this->_cache=$value;
- }
-
- /**
- * @param TDbConnection default database connection
- */
- public function setDbConnection($conn)
- {
- $this->_connection=$conn;
- }
-
- /**
- * @return TDbConnection default database connection
- */
- public function getDbConnection()
- {
- return $this->_connection;
- }
-
- /**
- * @return TActiveRecordManager static instance of record manager.
- */
- public static function getInstance($self=null)
- {
- static $instance;
- if($self!==null)
- $instance=$self;
- else if($instance===null)
- $instance = new self;
- return $instance;
- }
-
- /**
- * @return TActiveRecordGateway record gateway.
- */
- public function getRecordGateway()
- {
- if($this->_gateway === null) {
- $this->_gateway = $this->createRecordGateway();
- }
- return $this->_gateway;
- }
-
- /**
- * @return TActiveRecordGateway default record gateway.
- */
- protected function createRecordGateway()
- {
- 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;
- }
-
- /**
- * @return TActiveRecordInvalidFinderResult Defaults to '{@link TActiveRecordInvalidFinderResult::Null Null}'.
- * @since 3.1.5
- * @see setInvalidFinderResult
- */
- public function getInvalidFinderResult()
- {
- return $this->_invalidFinderResult;
- }
-
- /**
- * Define the way an active record finder react if an invalid magic-finder invoked
- * @param TActiveRecordInvalidFinderResult
- * @since 3.1.5
- * @see getInvalidFinderResult
- */
- public function setInvalidFinderResult($value)
- {
- $this->_invalidFinderResult = TPropertyValue::ensureEnum($value, 'TActiveRecordInvalidFinderResult');
- }
-}
+ * @license http://www.pradosoft.com/license/ + * @version $Id$ + * @package System.Data.ActiveRecord + */ + +Prado::using('System.Data.TDbConnection'); +Prado::using('System.Data.ActiveRecord.TActiveRecord'); +Prado::using('System.Data.ActiveRecord.Exceptions.TActiveRecordException'); +Prado::using('System.Data.ActiveRecord.TActiveRecordGateway'); + +/** + * TActiveRecordManager provides the default DB connection, + * default active record gateway, and table meta data inspector. + * + * The default connection can be set as follows: + * <code> + * TActiveRecordManager::getInstance()->setDbConnection($conn); + * </code> + * All new active record created after setting the + * {@link DbConnection setDbConnection()} will use that connection unless + * the custom ActiveRecord class overrides the ActiveRecord::getDbConnection(). + * + * 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 <weizho[at]gmail[dot]com> + * @version $Id$ + * @package System.Data.ActiveRecord + * @since 3.1 + */ +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; + + private $_cache; + + /** + * Defaults to '{@link TActiveRecordInvalidFinderResult::Null Null}' + * + * @var TActiveRecordInvalidFinderResult + * @since 3.1.5 + */ + private $_invalidFinderResult = TActiveRecordInvalidFinderResult::Null; + + /** + * @return ICache application cache. + */ + public function getCache() + { + return $this->_cache; + } + + /** + * @param ICache application cache + */ + public function setCache($value) + { + $this->_cache=$value; + } + + /** + * @param TDbConnection default database connection + */ + public function setDbConnection($conn) + { + $this->_connection=$conn; + } + + /** + * @return TDbConnection default database connection + */ + public function getDbConnection() + { + return $this->_connection; + } + + /** + * @return TActiveRecordManager static instance of record manager. + */ + public static function getInstance($self=null) + { + static $instance; + if($self!==null) + $instance=$self; + else if($instance===null) + $instance = new self; + return $instance; + } + + /** + * @return TActiveRecordGateway record gateway. + */ + public function getRecordGateway() + { + if($this->_gateway === null) { + $this->_gateway = $this->createRecordGateway(); + } + return $this->_gateway; + } + + /** + * @return TActiveRecordGateway default record gateway. + */ + protected function createRecordGateway() + { + 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; + } + + /** + * @return TActiveRecordInvalidFinderResult Defaults to '{@link TActiveRecordInvalidFinderResult::Null Null}'. + * @since 3.1.5 + * @see setInvalidFinderResult + */ + public function getInvalidFinderResult() + { + return $this->_invalidFinderResult; + } + + /** + * Define the way an active record finder react if an invalid magic-finder invoked + * @param TActiveRecordInvalidFinderResult + * @since 3.1.5 + * @see getInvalidFinderResult + */ + public function setInvalidFinderResult($value) + { + $this->_invalidFinderResult = TPropertyValue::ensureEnum($value, 'TActiveRecordInvalidFinderResult'); + } +} |