Witam,

Mam taki kod:
  1. public function executeList(sfWebRequest $request)
  2. {
  3. $this->voivodship_id = $request->getParameter('id', 0);
  4. $this->pager = new sfPropelPager('Restaurant', sfConfig::get('app_max_restaurants_per_page'));
  5. $c = new Criteria();
  6. if($this->voivodship_id > 0)
  7. {
  8.  
  9. $c->add(CityPeer::VOIVODSHIP_ID, $this->voivodship_id);
  10.  
  11. }
  12. //RestaurantPeer::doSelectJoinCity($c)
  13. $this->pager->setCriteria($c);
  14. $this->pager->setPeerMethod('doSelectJoinCity');
  15.  
  16. $this->pager->setPeerCountMethod('doCountJoinCity');
  17. $this->pager->setPage($this->getRequestParameter('page', 1));
  18.  
  19. $this->pager->init();
  20. }

Jak $this->voivodhship_id nie spełnia warunku w IF to zapytanie doSelectJoinCity jest wykonywane. Jak jest IF spełniony to doSelectJoinCity się nie wykonuje, jedynie doCountJoinCity. Dlaczego? Próbowałem coś ze zmianą kolejności itd ale coś nie pomogło.

pzdr.