/** * @throws CException */ public function run() { $criteria = new CDbCriteria(['limit' => $this->limit, 'order' => $this->order, 'scopes' => ['published']]); if (null === $this->category) { $producers = Producer::model()->findAll($criteria); } else { $producers = $this->producerRepository->getForCategory($this->category, $criteria); } $this->render($this->view, ['producers' => $producers]); }
/** * @throws CException */ public function run() { $criteria = new CDbCriteria(['limit' => $this->limit, 'order' => $this->order, 'scopes' => ['published']]); $this->render($this->view, ['brands' => $this->category ? $this->producerRepository->getForCategory($this->category, $criteria) : Producer::model()->findAll($criteria), 'title' => $this->title]); }