1
0
mirror of synced 2024-12-14 07:06:04 +03:00

Fix for ticket #457, moves Doctrine_Record::find/One() to Doctrine_Table::execute/One()

Ticket: 457
This commit is contained in:
adamthehutt 2007-10-08 16:39:12 +00:00
parent f1162cd56d
commit 6b26a7b813
3 changed files with 42 additions and 40 deletions

View File

@ -1421,45 +1421,6 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
}
}
/**
* 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, $this->_table->getComponentName())
->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, $this->_table->getComponentName())
->fetchOne($params, $hydrationMode);
}
/**
* call
*

View File

@ -886,6 +886,47 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
{
return $this->findBySql($dql, $params, $hydrationMode);
}
/**
* execute
* 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 execute($queryKey, $params = array(), $hydrationMode = Doctrine::HYDRATE_RECORD)
{
return Doctrine_Manager::getInstance()
->getQueryRegistry()
->get($queryKey, $this->getComponentName())
->execute($params, $hydrationMode);
}
/**
* executeOne
* 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 executeOne($queryKey, $params = array(), $hydrationMode = Doctrine::HYDRATE_RECORD)
{
return Doctrine_Manager::getInstance()
->getQueryRegistry()
->get($queryKey, $this->getComponentName())
->fetchOne($params, $hydrationMode);
}
/**
* clear
* clears the first level cache (identityMap)

View File

@ -62,6 +62,6 @@ class Doctrine_Query_Registry_TestCase extends Doctrine_UnitTestCase
$user = new User();
$user->find('all');
$user->getTable()->execute('all');
}
}