summaryrefslogtreecommitdiff
path: root/framework/Data/SqlMap/Configuration/TSqlMapXmlConfigBuilder.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Data/SqlMap/Configuration/TSqlMapXmlConfigBuilder.php')
-rw-r--r--framework/Data/SqlMap/Configuration/TSqlMapXmlConfigBuilder.php22
1 files changed, 14 insertions, 8 deletions
diff --git a/framework/Data/SqlMap/Configuration/TSqlMapXmlConfigBuilder.php b/framework/Data/SqlMap/Configuration/TSqlMapXmlConfigBuilder.php
index 47982fca..b74340bd 100644
--- a/framework/Data/SqlMap/Configuration/TSqlMapXmlConfigBuilder.php
+++ b/framework/Data/SqlMap/Configuration/TSqlMapXmlConfigBuilder.php
@@ -6,16 +6,18 @@
* @link http://www.pradosoft.com/
* @copyright Copyright © 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @package System.Data.SqlMap.Configuration
+ * @package Prado\Data\SqlMap\Configuration
*/
+namespace Prado\Data\SqlMap\Configuration;
+
Prado::using('System.Data.SqlMap.Configuration.TSqlMapStatement');
/**
* TSqlMapXmlConfig class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
- * @package System.Data.SqlMap.Configuration
+ * @package Prado\Data\SqlMap\Configuration
*/
abstract class TSqlMapXmlConfigBuilder
{
@@ -36,7 +38,6 @@ abstract class TSqlMapXmlConfigBuilder
throw new TSqlMapConfigurationException(
'sqlmap_node_class_undef', $node, $this->getConfigFile());
}
-
/**
* For each attributes (excluding attribute named in $except) set the
* property of the $obj given by the name of the attribute with the value
@@ -60,7 +61,6 @@ abstract class TSqlMapXmlConfigBuilder
}
}
}
-
/**
* Gets the filename relative to the basefile.
* @param string base filename
@@ -79,7 +79,6 @@ abstract class TSqlMapXmlConfigBuilder
throw new TSqlMapConfigurationException(
'sqlmap_unable_to_find_resource', $resource);
}
-
/**
* Load document using simple xml.
* @param string filename.
@@ -89,13 +88,11 @@ abstract class TSqlMapXmlConfigBuilder
{
if( strpos($filename, '${') !== false)
$filename = $config->replaceProperties($filename);
-
if(!is_file($filename))
throw new TSqlMapConfigurationException(
'sqlmap_unable_to_find_config', $filename);
return simplexml_load_string($config->replaceProperties(file_get_contents($filename)));
}
-
/**
* Get element node by ID value (try for attribute name ID as case insensitive).
* @param SimpleXmlDocument $document
@@ -108,4 +105,13 @@ abstract class TSqlMapXmlConfigBuilder
//hack to allow upper case and lower case attribute names.
foreach(array('id','ID','Id', 'iD') as $id)
{
- $xpath = "//{$tag}[@{$id}='{$value} \ No newline at end of file
+ $xpath = "//{$tag}[@{$id}='{$value}']";
+ foreach($document->xpath($xpath) as $node)
+ return $node;
+ }
+ }
+ /**
+ * @return string configuration file.
+ */
+ protected abstract function getConfigFile();
+} \ No newline at end of file