Fix for ticket #457, moves Doctrine_Record::find/One() to Doctrine_Table::execute/One()
Ticket: 457
This commit is contained in:
parent
f1162cd56d
commit
6b26a7b813
@ -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
|
* call
|
||||||
*
|
*
|
||||||
|
@ -886,6 +886,47 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
|||||||
{
|
{
|
||||||
return $this->findBySql($dql, $params, $hydrationMode);
|
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
|
* clear
|
||||||
* clears the first level cache (identityMap)
|
* clears the first level cache (identityMap)
|
||||||
|
@ -62,6 +62,6 @@ class Doctrine_Query_Registry_TestCase extends Doctrine_UnitTestCase
|
|||||||
|
|
||||||
$user = new User();
|
$user = new User();
|
||||||
|
|
||||||
$user->find('all');
|
$user->getTable()->execute('all');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user