diff --git a/lib/Doctrine/Hydrate.php b/lib/Doctrine/Hydrate.php index 19a4a219a..5f6917937 100644 --- a/lib/Doctrine/Hydrate.php +++ b/lib/Doctrine/Hydrate.php @@ -147,7 +147,28 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable } $this->_conn = $connection; } - + /** + * getRoot + * returns the root component for this object + * + * @return Doctrine_Table root components table + */ + public function getRoot() + { + $map = reset($this->_aliasMap); + + if ( ! isset($map['table'])) { + throw new Doctrine_Hydrate_Exception('Root component not initialized.'); + } + + return $map['table']; + } + /** + * getSql + * return the sql associated with this object + * + * @return string sql query string + */ public function getSql() { return $this->getQuery();