diff --git a/lib/Doctrine/Manager.php b/lib/Doctrine/Manager.php index bbe0e1828..e9f12660e 100644 --- a/lib/Doctrine/Manager.php +++ b/lib/Doctrine/Manager.php @@ -158,7 +158,44 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera return $this; } - + /** + * fetch + * fetches data using the provided queryKey and + * the associated query in the query registry + * + * if no query for given queryKey is being found a + * Doctrine_Query_Registry exception is being thrown + * + * @param string $queryKey the query key + * @param array $params prepared statement params (if any) + * @return mixed the fetched data + */ + public function find($queryKey, $params = array(), $hydrationMode = Doctrine::HYDRATE_RECORD) + { + return Doctrine_Manager::getInstance() + ->getQueryRegistry() + ->get($queryKey) + ->execute($params, $hydrationMode); + } + /** + * fetchOne + * fetches data using the provided queryKey and + * the associated query in the query registry + * + * if no query for given queryKey is being found a + * Doctrine_Query_Registry exception is being thrown + * + * @param string $queryKey the query key + * @param array $params prepared statement params (if any) + * @return mixed the fetched data + */ + public function findOne($queryKey, $params = array(), $hydrationMode = Doctrine::HYDRATE_RECORD) + { + return Doctrine_Manager::getInstance() + ->getQueryRegistry() + ->get($queryKey) + ->fetchOne($params, $hydrationMode); + } /** * connection * diff --git a/lib/Doctrine/Record.php b/lib/Doctrine/Record.php index c109c34ff..8750adbf8 100644 --- a/lib/Doctrine/Record.php +++ b/lib/Doctrine/Record.php @@ -1399,7 +1399,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count * @param array $params prepared statement params (if any) * @return mixed the fetched data */ - public function fetch($queryKey, $params = array(), $hydrationMode = Doctrine::HYDRATE_RECORD) + public function find($queryKey, $params = array(), $hydrationMode = Doctrine::HYDRATE_RECORD) { return Doctrine_Manager::getInstance() ->getQueryRegistry() @@ -1418,7 +1418,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count * @param array $params prepared statement params (if any) * @return mixed the fetched data */ - public function fetchOne($queryKey, $params = array(), $hydrationMode = Doctrine::HYDRATE_RECORD) + public function findOne($queryKey, $params = array(), $hydrationMode = Doctrine::HYDRATE_RECORD) { return Doctrine_Manager::getInstance() ->getQueryRegistry()