Changeset 4666 for branches/1.0/lib/Doctrine/Table.php
- Timestamp:
- 07/12/08 20:11:44 (6 months ago)
- Files:
-
- 1 modified
-
branches/1.0/lib/Doctrine/Table.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/lib/Doctrine/Table.php
r4665 r4666 1217 1217 return $record; 1218 1218 } 1219 1220 /** 1221 * adds a named query in the query registry 1222 * 1223 * @param $queryKey Query key name 1224 * @param $query DQL string or Doctrine_Query object 1225 * @return void 1226 */ 1227 public function addNamedQuery($queryKey, $query) 1228 { 1229 $registry = Doctrine_Manager::getInstance()->getQueryRegistry(); 1230 $registry->add($this->getComponentName() . '/' . $queryKey, $query); 1231 } 1232 1233 /** 1234 * creates a named query in the query registry 1235 * 1236 * @param $queryKey Query key name 1237 * @return Doctrine_Query 1238 */ 1239 public function createNamedQuery($queryKey) 1240 { 1241 return Doctrine_Manager::getInstance()->getQueryRegistry() 1242 ->get($queryKey, $this->getComponentName()); 1243 } 1244 1219 1245 1220 1246 /** … … 1305 1331 public function execute($queryKey, $params = array(), $hydrationMode = Doctrine::HYDRATE_RECORD) 1306 1332 { 1307 return Doctrine_Manager::getInstance() 1308 ->getQueryRegistry() 1309 ->get($queryKey, $this->getComponentName()) 1310 ->execute($params, $hydrationMode); 1333 return $this->createNamedQuery($queryKey)->execute($params, $hydrationMode); 1311 1334 } 1312 1335 … … 1325 1348 public function executeOne($queryKey, $params = array(), $hydrationMode = Doctrine::HYDRATE_RECORD) 1326 1349 { 1327 return Doctrine_Manager::getInstance() 1328 ->getQueryRegistry() 1329 ->get($queryKey, $this->getComponentName()) 1330 ->fetchOne($params, $hydrationMode); 1350 return $this->createNamedQuery($queryKey)->fetchOne($params, $hydrationMode); 1331 1351 } 1332 1352