summaryrefslogtreecommitdiff
path: root/framework/Data/SqlMap/TSqlMapManager.php
diff options
context:
space:
mode:
authorwei <>2006-12-17 22:20:50 +0000
committerwei <>2006-12-17 22:20:50 +0000
commit2570226fbac3e26b1e94896b50d1db4bc1aa3308 (patch)
tree421108ccbdc0ef021e6af4fa35b1d6bcbc352b37 /framework/Data/SqlMap/TSqlMapManager.php
parentddc0de38f64e5834ce04f0407a8416172b596655 (diff)
Add TDataSourceConfig, TSqlMapConfig, TActiveRecordConfig
Diffstat (limited to 'framework/Data/SqlMap/TSqlMapManager.php')
-rw-r--r--framework/Data/SqlMap/TSqlMapManager.php25
1 files changed, 16 insertions, 9 deletions
diff --git a/framework/Data/SqlMap/TSqlMapManager.php b/framework/Data/SqlMap/TSqlMapManager.php
index 32656bd5..37d50f5d 100644
--- a/framework/Data/SqlMap/TSqlMapManager.php
+++ b/framework/Data/SqlMap/TSqlMapManager.php
@@ -14,10 +14,12 @@ Prado::using('System.Data.SqlMap.TSqlMapGateway');
Prado::using('System.Data.SqlMap.DataMapper.TSqlMapException');
Prado::using('System.Data.SqlMap.DataMapper.TSqlMapTypeHandlerRegistry');
Prado::using('System.Data.SqlMap.DataMapper.TSqlMapCache');
-Prado::using('System.Data.SqlMap.DataMapper.*');
+Prado::using('System.Data.SqlMap.Configuration.TSqlMapStatement');
Prado::using('System.Data.SqlMap.Configuration.*');
+Prado::using('System.Data.SqlMap.DataMapper.*');
Prado::using('System.Data.SqlMap.Statements.*');
+
/**
* TSqlMapManager class holds the sqlmap configuation result maps, statements
* parameter maps and a type handler factory.
@@ -27,7 +29,8 @@ Prado::using('System.Data.SqlMap.Statements.*');
*
* <code>
* $conn = new TDbConnection($dsn,$dbuser,$dbpass);
- * $manager = new TSqlMapManager($conn, 'mydb-sqlmap.xml');
+ * $manager = new TSqlMapManager($conn);
+ * $manager->configureXml('mydb-sqlmap.xml');
* $sqlmap = $manager->getSqlMapGateway();
* $result = $sqlmap->queryForObject('Products');
* </code>
@@ -46,9 +49,6 @@ class TSqlMapManager extends TComponent
private $_cacheModels;
private $_connection;
-
- private $_configFile;
-
private $_gateway;
/**
@@ -56,10 +56,9 @@ class TSqlMapManager extends TComponent
* @param TDbConnection database connection
* @param string configuration file.
*/
- public function __construct($connection=null,$configFile=null)
+ public function __construct($connection=null)
{
$this->_connection=$connection;
- $this->_configFile=$configFile;
$this->_mappedStatements=new TMap;
$this->_resultMaps=new TMap;
@@ -120,14 +119,22 @@ class TSqlMapManager extends TComponent
}
/**
+ * Loads and parses the SqlMap configuration file.
+ * @param string xml configuration file.
+ */
+ public function configureXml($file)
+ {
+ $config = new TSqlMapXmlConfiguration($this);
+ $config->configure($file);
+ }
+
+ /**
* Configures the current TSqlMapManager using the given xml configuration file
* defined in {@link ConfigFile setConfigFile()}.
* @return TSqlMapGateway create and configure a new TSqlMapGateway.
*/
protected function createSqlMapGateway()
{
- $config = new TSqlMapXmlConfiguration($this);
- $config->configure($this->getConfigFile());
return new TSqlMapGateway($this);
}