protected function getPager(sfWebRequest $request) { $q = Doctrine::getTable('AlbumComment')->createQuery()->where('album_id = ?', $this->album->id)->orderBy('created_at DESC'); $pager = new sfDoctrinePager('AlbumComment'); $pager->setQuery($q); $pager->setPage($request['commentPage']); $pager->setMaxPerPage($this->size); return $pager; }
public function executeIndex(sfWebRequest $request) { $this->buildParams(); $this->max_per_page = $this->getUser()->getAttribute('max_per_page', sfConfig::get('app_aBlog_max_per_page', 20), 'apostropheBlog_prefs'); $pager = new sfDoctrinePager($this->modelClass); $pager->setMaxPerPage($this->max_per_page); $pager->setQuery($this->buildQuery($request)); $pager->setPage($this->getRequestParameter('page', 1)); $pager->init(); $this->pager = $pager; aBlogItemTable::populatePages($pager->getResults()); if ($request->hasParameter('year') || $request->hasParameter('month') || $request->hasParameter('day') || $request->hasParameter('cat') || $request->hasParameter('tag')) { // Forbid combinations of filters for bots like Google. This prevents aggressive overspidering // of the same data $this->getResponse()->addMeta('robots', 'noarchive, nofollow'); } if ($this->getRequestParameter('feed', false)) { $this->getFeed(); return sfView::NONE; } return $this->pageTemplate; }
/** * @see sfPager */ public function setMaxPerPage($maxPerPage) { parent::setMaxPerPage($maxPerPage); return $this; }