Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Les routes
- // Avant
- cinema:
- url: /:sf_culture/cinema/:page
- param: { module: cinema, action: index }
- cinema_show:
- class: sfDoctrineRoute
- url: /:sf_culture/cinema/:page/:slug.html
- param: { module: cinema, action: show }
- options:
- model: Cinema
- type: object
- method: getPublishedBySlug
- // Après
- cinema:
- class: sfDoctrineRoute
- url: /:sf_culture/cinema/:page
- param: { module: cinema, action: index }
- options:
- model: Cinema
- type: object
- method: getLastPublished
- cinema_show:
- class: sfDoctrineRoute
- url: /:sf_culture/cinema/:page/:slug.html
- param: { module: cinema, action: show }
- options:
- model: Cinema
- type: object
- method: getPublishedBySlug
- // Les actions
- // Avant qui ne marchait pas
- class cinemaActions extends sfActions
- {
- protected function getPager($page)
- {
- $this->pager = new sfDoctrinePager('Cinema', sfConfig::get('app_news_page_count'));
- $this->pager->setQuery(Doctrine::getTable('Cinema')->getPublishedQuery($this->getUser()->getCulture()));
- $this->pager->setPage($page);
- $this->pager->init();
- }
- public function executeIndex(sfWebRequest $request)
- {
- $this->cinema = Doctrine::getTable('cinema')->getLastPublished();
- $this->getPager($request->getParameter('page', 1));
- $this->setTemplate('show');
- }
- public function executeShow(sfWebRequest $request)
- {
- $this->cinema = $this->getRoute()->getObject();
- $this->getPager($request->getParameter('page', 1));
- }
- }
- // Après qui marche
- class cinemaActions extends sfActions
- {
- protected function getPager($page)
- {
- $this->pager = new sfDoctrinePager('Cinema', sfConfig::get('app_news_page_count'));
- $this->pager->setQuery(Doctrine::getTable('Cinema')->getPublishedQuery($this->getUser()->getCulture()));
- $this->pager->setPage($page);
- $this->pager->init();
- }
- public function executeIndex(sfWebRequest $request)
- {
- $this->cinema = $this->getRoute()->getObject();
- $this->getPager($request->getParameter('page', 1));
- $this->setTemplate('show');
- }
- public function executeShow(sfWebRequest $request)
- {
- $this->cinema = $this->getRoute()->getObject();
- $this->getPager($request->getParameter('page', 1));
- }
- }
Add Comment
Please, Sign In to add comment