Codigo tipico para personalizar consulta en actionphp
Versión 1 (Guillermo Zdanowicz, 04/09/2011 12:29)
| 1 | 1 | Guillermo Zdanowicz | h1. Codigo tipico para personalizar consulta en actionphp |
|---|---|---|---|
| 2 | 1 | Guillermo Zdanowicz | |
| 3 | 1 | Guillermo Zdanowicz | public function executeList(sfWebRequest $request) |
| 4 | 1 | Guillermo Zdanowicz | { |
| 5 | 1 | Guillermo Zdanowicz | $maxLimit = 10; |
| 6 | 1 | Guillermo Zdanowicz | $this->pager = new sfDoctrinePager('contactos', $maxLimit); |
| 7 | 1 | Guillermo Zdanowicz | |
| 8 | 1 | Guillermo Zdanowicz | |
| 9 | 1 | Guillermo Zdanowicz | //$this->pager->setQuery(Doctrine::getTable('netNews')->createQuery('a')); |
| 10 | 1 | Guillermo Zdanowicz | |
| 11 | 1 | Guillermo Zdanowicz | $q = Doctrine_Query::create() |
| 12 | 1 | Guillermo Zdanowicz | ->from('contactos c') |
| 13 | 1 | Guillermo Zdanowicz | ->where('c.tipocontacto_id = 1'); |
| 14 | 1 | Guillermo Zdanowicz | |
| 15 | 1 | Guillermo Zdanowicz | $this->pager->setQuery($q); |
| 16 | 1 | Guillermo Zdanowicz | $this->pager->setPage($request->getParameter('page', 1)); |
| 17 | 1 | Guillermo Zdanowicz | $this->pager->init(); |
| 18 | 1 | Guillermo Zdanowicz | } |