PHP notice

Trying to get property of non-object

/var/www/changeonelife/app/src/protected/widgets/ConsultantsWidget.php(157)

145         $vars = $this->controller->getVariables();
146         if (!isset($vars['alias'])) {
147             throw new CHttpException(404, REQUESTED_PAGE_DOES_NOT_EXIST);
148         }
149 
150         $criteria = new CDbCriteria;
151         $criteria->compare('is_active', 1);
152         $criteria->compare('alias', $vars['alias']);
153         
154         $expert = ConsultationExpert::model()->localized()->find($criteria);
155         
156         $criteria = new CDbCriteria;
157         $criteria->condition = 'answer_expert_id='.$expert->id.' AND is_active=1 AND status=1';
158         $criteria->compare('is_active', 1);
159         $page = isset($vars['page']) ? $vars['page'] : 1;
160         $perPage         = 10;
161         $criteria->limit = $perPage;
162         $criteria->offset = ($page - 1) * $criteria->limit;
163         
164         $answers = new CArrayDataProvider(ConsultationQuestion::model()->localized()->findAll($criteria));
165         $count = ConsultationQuestion::model()->count($criteria);
166 
167         if (empty($expert)) {
168             throw new CHttpException(404, REQUESTED_PAGE_DOES_NOT_EXIST);
169         }    

Stack Trace

#0
+
 /var/www/changeonelife/app/src/protected/widgets/ConsultantsWidget.php(57): ConsultantsWidget->actionView()
52     {
53         $actionsList = self::getActionsList();
54 
55         if (isset($actionsList[$this->action]))
56         {
57             $this->{'action' . $this->action}();
58         }
59     }
60     
61     /**
62      * Список консультантов
#2
+
 /var/www/changeonelife/app/src/protected/extensions/PageHelper.php(293): CBaseController->widget("ConsultantsWidget", array("action" => "view", "category_id" => "1"), true)
288             foreach ($blocks as $block) {
289                 
290                 switch ($block->type_id) {
291                     case 1: //widget
292                         $data = unserialize($block->content);
293                         $content = $controller->widget(array_shift($data), $data, true);
294                         break;
295                     case 2: //text
296                         $content = $block->content;
297                         break;
298                 }
#3
+
 /var/www/changeonelife/app/src/protected/controllers/SiteController.php(647): PageHelper::prepareBlocks(SiteController, array("content1" => stdClass, "right1" => stdClass, "left1" => stdClass))
642             }
643 
644             try {
645 
646                 //получаем вектор с заполненными переменными шаблона
647                 $preparedBlocks = CMap::mergeArray($preparedBlocks, PageHelper::prepareBlocks($this, $data['blocks']));
648             } catch (CException $e) {
649 
650                 if (($e instanceof CHttpException) && 404 == $e->statusCode && !$this->_is404Call) {
651                     $this->render404Page();
652                 } /* else if (!YII_DEBUG) {
2024-03-29 15:10:58 nginx/1.18.0 Yii Framework/1.1.14