summaryrefslogtreecommitdiff
path: root/framework/DataAccess/SQLMap/Configuration/TResultMap.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/DataAccess/SQLMap/Configuration/TResultMap.php')
-rw-r--r--framework/DataAccess/SQLMap/Configuration/TResultMap.php63
1 files changed, 63 insertions, 0 deletions
diff --git a/framework/DataAccess/SQLMap/Configuration/TResultMap.php b/framework/DataAccess/SQLMap/Configuration/TResultMap.php
new file mode 100644
index 00000000..0f09a1ba
--- /dev/null
+++ b/framework/DataAccess/SQLMap/Configuration/TResultMap.php
@@ -0,0 +1,63 @@
+<?php
+
+class TResultMap extends TComponent
+{
+ private $_ID='';
+ private $_className='';
+ private $_columns='';
+ private $_extendMap='';
+ private $_groupBy='';
+ private $_discriminator=null;
+
+ public function __construct()
+ {
+ $this->_columns = new TMap;
+ }
+
+ public function getID(){ return $this->_ID; }
+ public function setID($value){ $this->_ID = $value; }
+
+ public function getClass(){ return $this->_className; }
+ public function setClass($value){ $this->_className = $value; }
+
+ public function getColumns(){ return $this->_columns; }
+ public function setColumns($value){ $this->_columns = $value; }
+
+ public function getExtends(){ return $this->_extendMap; }
+ public function setExtends($value){ $this->_extendMap = $value; }
+
+ public function getGroupBy(){ return $this->_groupBy; }
+ public function setGroupBy($value){ $this->_groupBy = $value; }
+
+ public function getDiscriminator(){ return $this->_discriminator; }
+ public function setDiscriminator($value){ $this->_discriminator = $value; }
+
+ public function addResultProperty(TResultProperty $property)
+ {
+ $this->_columns->add($property->getProperty(), $property);
+ }
+
+ public function createInstanceOfResult()
+ {
+ return TTypeHandlerFactory::createInstanceOf($this->getClass());
+ }
+
+ public function resolveSubMap($row)
+ {
+ $subMap = $this;
+ if(!is_null($disc = $this->getDiscriminator()))
+ {
+ $mapping = $disc->getMapping();
+ $dataValue = $mapping->getDatabaseValue($row);
+ $subMap = $disc->getSubMap((string)$dataValue);
+
+ if(is_null($subMap))
+ $subMap = $this;
+ else if($subMap !== $this)
+ $subMap = $subMap->resolveSubMap($row);
+ }
+ return $subMap;
+ }
+}
+
+?> \ No newline at end of file