Commit da1173f2 authored by romanb's avatar romanb

[2.0] Some cleanups.

parent 523c93c2
......@@ -23,6 +23,7 @@ namespace Doctrine\ORM\Internal\Hydration;
use \PDO;
use Doctrine\ORM\PersistentCollection;
use Doctrine\Common\Collections\Collection;
/**
* The ObjectHydrator constructs an object graph out of an SQL result set.
......@@ -72,7 +73,7 @@ class ObjectHydrator extends AbstractHydrator
if ($this->_parserResult->isMixedQuery()) {
$result = array();
} else {
$result = new \Doctrine\Common\Collections\Collection;
$result = new Collection;
}
$cache = array();
......@@ -122,7 +123,7 @@ class ObjectHydrator extends AbstractHydrator
if ( ! is_object($coll)) {
end($coll);
$this->_resultPointers[$dqlAlias] =& $coll[key($coll)];
} else if ($coll instanceof \Doctrine\Common\Collections\Collection) {
} else if ($coll instanceof Collection) {
if (count($coll) > 0) {
$this->_resultPointers[$dqlAlias] = $coll->last();
}
......
......@@ -41,192 +41,16 @@ abstract class AbstractResult
*/
protected $_data;
/**
* @var array $_queryComponents
*
* Two dimensional array containing the map for query aliases. Main keys are component aliases.
*
* metadata Table object associated with given alias.
* relation Relation object owned by the parent.
* parent Alias of the parent.
* map Name of the column / aggregate value this component is mapped to a collection.
*/
//protected $_queryComponents = array();
/**
* @var array Table alias map. Keys are SQL aliases and values DQL aliases.
*/
//protected $_tableAliasMap = array();
/**
* @var array Enum params.
*/
protected $_enumParams = array();
/**
* @var string
*/
//protected $_defaultQueryComponentAlias;
/**
* @var boolean
*/
protected $_isMixedQuery = false;
/**
* Defines the mapping components.
*
* @param array $queryComponents Query components.
*/
/*public function setQueryComponents(array $queryComponents)
{
$this->_queryComponents = $queryComponents;
}*/
/**
* Sets the declaration for given component alias.
*
* @param string $componentAlias The component alias to set the declaration to.
* @param string $queryComponent Alias declaration.
*/
/*public function setQueryComponent($componentAlias, array $queryComponent)
{
$this->_queryComponents[$componentAlias] = $queryComponent;
}*/
/**
* Gets the mapping components.
*
* @return array Query components.
*/
/*public function getQueryComponents()
{
return $this->_queryComponents;
}*/
/**
*
*/
/*public function getDefaultQueryComponentAlias()
{
return $this->_defaultQueryComponentAlias;
}*/
/**
*
*
* @param <type> $alias
*/
/*public function setDefaultQueryComponentAlias($alias)
{
$this->_defaultQueryComponentAlias = $alias;
}*/
/**
* Get the declaration for given component alias.
*
* @param string $componentAlias The component alias the retrieve the declaration from.
* @return array Alias declaration.
*/
/*public function getQueryComponent($componentAlias)
{
if ( ! isset($this->_queryComponents[$componentAlias])) {
throw new DoctrineException('Unknown query component ' . $componentAlias);
}
return $this->_queryComponents[$componentAlias];
}*/
/**
* Get the component alias for a given query component
*
* @param array $queryComponent The query component
* @param string Component alias
*/
/*public function getComponentAlias($queryComponent)
{
return array_search($queryComponent, $this->_queryComponents);;
}*/
/**
* Whether or not this object has a declaration for given component alias.
*
* @param string $componentAlias Component alias the retrieve the declaration from.
* @return boolean True if this object has given alias, otherwise false.
*/
/*public function hasQueryComponent($componentAlias)
{
return isset($this->_queryComponents[$componentAlias]);
}*/
/**
* Defines the table aliases.
*
* @param array $tableAliasMap Table aliases.
*/
/*public function setTableAliasMap(array $tableAliasMap)
{
$this->_tableAliasMap = $tableAliasMap;
}*/
/**
* Adds an SQL table alias and associates it a component alias
*
* @param string $tableAlias Table alias to be added.
* @param string $componentAlias Alias for the query component associated with given tableAlias.
*/
/*public function setTableAlias($tableAlias, $componentAlias)
{
$this->_tableAliasMap[$tableAlias] = $componentAlias;
}*/
/**
* Returns all table aliases.
*
* @return array Table aliases as an array.
*/
/*public function getTableAliasMap()
{
return $this->_tableAliasMap;
}*/
/**
* Get DQL alias associated with given SQL table alias.
*
* @param string $tableAlias SQL table alias that identifies the component alias
* @return string Component alias
*/
/*public function getTableAlias($tableAlias)
{
if ( ! isset($this->_tableAliasMap[$tableAlias])) {
throw DoctrineException::updateMe('Unknown table alias ' . $tableAlias);
}
return $this->_tableAliasMap[$tableAlias];
}*/
/**
* Get table alias associated with given component alias.
*
* @param string $componentAlias Component alias that identifies the table alias
* @return string Component alias
*/
/*public function getTableAliasFromComponentAlias($componentAlias)
{
return array_search($componentAlias, $this->_tableAliasMap);
}*/
/**
* Whether or not this object has given tableAlias.
*
* @param string $tableAlias Table alias to be checked.
* @return boolean True if this object has given alias, otherwise false.
*/
/*public function hasTableAlias($tableAlias)
{
return (isset($this->_tableAliasMap[$tableAlias]));
}*/
/**
* Gets whether the parsed query selects objects/arrays and scalar values
* at the same time.
......@@ -257,25 +81,6 @@ abstract class AbstractResult
return $this->_enumParams;
}
/**
* Sets input parameter as an enumerated parameter
*
* @param string $key The key of the input parameter
* @return Doctrine_ORM_Query_AbstractResult
*/
/*public function addEnumParam($key, $table = null, $column = null)
{
$array = (isset($table) || isset($column)) ? array($table, $column) : array();
if ($key === '?') {
$this->_enumParams[] = $array;
} else {
$this->_enumParams[$key] = $array;
}
return $this;
}*/
/**
* Returns this object in serialized format, revertable using fromCached*.
*
......
......@@ -40,13 +40,6 @@ class ParserResult extends AbstractResult
*/
protected $_em;
/**
* Simple array of keys representing the fields used in query.
*
* @var array $_queryFields
*/
//protected $_queryFields = array();
protected $_resultSetMapping;
public function __construct()
......@@ -110,61 +103,4 @@ class ParserResult extends AbstractResult
{
return $this->_data;
}
/**
* Defines the mapping fields.
*
* @param array $queryFields Query fields.
*/
/*public function setQueryFields(array $queryFields)
{
$this->_queryFields = $queryFields;
}*/
/**
* Sets the declaration for given field alias.
*
* @param string $fieldAlias The field alias to set the declaration to.
* @param string $queryField Alias declaration.
*/
/*public function setQueryField($fieldAlias, $queryField)
{
$this->_queryFields[$fieldAlias] = $queryField;
}*/
/**
* Gets the mapping fields.
*
* @return array Query fields.
*/
/*public function getQueryFields()
{
return $this->_queryFields;
}*/
/**
* Get the declaration for given field alias.
*
* @param string $fieldAlias The field alias the retrieve the declaration from.
* @return array Alias declaration.
*/
/*public function getQueryField($fieldAlias)
{
if ( ! isset($this->_queryFields[$fieldAlias])) {
throw DoctrineException::updateMe('Unknown query field ' . $fieldAlias);
}
return $this->_queryFields[$fieldAlias];
}*/
/**
* Whether or not this object has a declaration for given field alias.
*
* @param string $fieldAlias Field alias the retrieve the declaration from.
* @return boolean True if this object has given alias, otherwise false.
*/
/*public function hasQueryField($fieldAlias)
{
return isset($this->_queryFields[$fieldAlias]);
}*/
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment