Skip to content

Instantly share code, notes, and snippets.

@tayfunoziserikan
Created January 21, 2012 16:38
Show Gist options
  • Select an option

  • Save tayfunoziserikan/1653233 to your computer and use it in GitHub Desktop.

Select an option

Save tayfunoziserikan/1653233 to your computer and use it in GitHub Desktop.
Search
$searchQuery = Doctrine_Core::getTable('Model_Entity_City')
->search($this->_request->query);
$searchIds = array();
foreach ($searchQuery as $result) {
$searchIds[] = $result['id'];
}
// DQL
$query = Doctrine_Query::create()
->from('Model_Entity_City c')
->whereIn('c.id', $searchIds)
->orderBy("c.id ASC")
->useQueryCache(Kebab_Cache_Query::isEnable());
// Pager
$responseData = $query->execute()->toArray();
$this->_helper->response(true)->addTotal(count($responseData))->addData($responseData)->getResponse();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment