diff options
author | wei <> | 2006-07-16 06:19:36 +0000 |
---|---|---|
committer | wei <> | 2006-07-16 06:19:36 +0000 |
commit | c7d41e5bea4a5f96979a08da9cc9f79355edfe70 (patch) | |
tree | 8f21cba052c1eae7c7204ac272dd8c5e9d6fe110 /framework/DataAccess/SQLMap/Configuration/TResultMap.php | |
parent | af68030fcf0c266300feb2c100149ecadef7d364 (diff) |
Update Time Tracker demo.
Diffstat (limited to 'framework/DataAccess/SQLMap/Configuration/TResultMap.php')
-rw-r--r-- | framework/DataAccess/SQLMap/Configuration/TResultMap.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/framework/DataAccess/SQLMap/Configuration/TResultMap.php b/framework/DataAccess/SQLMap/Configuration/TResultMap.php index 0f09a1ba..b8032c81 100644 --- a/framework/DataAccess/SQLMap/Configuration/TResultMap.php +++ b/framework/DataAccess/SQLMap/Configuration/TResultMap.php @@ -8,6 +8,7 @@ class TResultMap extends TComponent private $_extendMap='';
private $_groupBy='';
private $_discriminator=null;
+ private $_typeHandlerFactory=null;
public function __construct()
{
@@ -32,6 +33,11 @@ class TResultMap extends TComponent public function getDiscriminator(){ return $this->_discriminator; }
public function setDiscriminator($value){ $this->_discriminator = $value; }
+ public function initialize($sqlMap, $resultMap=null)
+ {
+ $this->_typeHandlerFactory = $sqlMap->getTypeHandlerFactory();
+ }
+
public function addResultProperty(TResultProperty $property)
{
$this->_columns->add($property->getProperty(), $property);
@@ -39,7 +45,21 @@ class TResultMap extends TComponent public function createInstanceOfResult()
{
- return TTypeHandlerFactory::createInstanceOf($this->getClass());
+ $handler = $this->_typeHandlerFactory->getTypeHandler($this->getClass());
+
+ try
+ {
+ if(!is_null($handler))
+ return $handler->createNewInstance();
+ else
+ return TTypeHandlerFactory::createInstanceOf($this->getClass());
+ }
+ catch (TDataMapperException $e)
+ {
+ throw new TSqlMapExecutionException(
+ 'sqlmap_unable_to_create_new_instance',
+ $this->getClass(), get_class($handler), $this->getID());
+ }
}
public function resolveSubMap($row)
|