Error

Call to a member function ancestors() on null

/var/www/elitih/elit.ua/protected/widgets/MenuWidget.php(58)

46 
47     public function run() {
48 
49         $mId =(int)$this->nested_menuId;
50 
51         if($mId == 206){
52             if ($this->controller instanceof PageController) { return;}
53 
54             $variables = $this->controller->getVariables();
55             $node = TreeCategory::model()->localized()->findByPk($variables['id']);
56             if($node->level==5) {$node =$node->parent()->find(); $variables['id'] = $node->id; }
57             //d($node->level);
58             $parents = $node->ancestors()->localized()->findAll();
59 
60             //d($parents);
61             if(isset($parents[2]))
62                 $variables['type'] = $parents[2]->id;
63             //d($parents);
64             // Конвертируем в дерево
65             $links = array();
66 
67             // Получаем ветку nested-sets для формирования меню
68             $root_item = TreeCategory::model()->localized()->findByPk($mId);
69             $criteria = new CDbCriteria;
70             $criteria->condition = 'is_active = 1';

Stack Trace

#1
+
 /var/www/elitih/elit.ua/protected/extensions/PageHelper.php(305): CBaseController->widget("MenuWidget", array("menuId" => "0", "nested_menuId" => "206", "templateName" => "menu_left"), true)
300             foreach ($blocks as $block) {
301 
302                 switch ($block->type_id) {
303                     case 1: //widget
304                         $data = unserialize($block->content);
305                         $content = $controller->widget(array_shift($data), $data, true);
306                         break;
307                     case 2: //text
308                         $content = $block->content;
309                         break;
310                 }
#2
+
 /var/www/elitih/elit.ua/protected/controllers/SiteController.php(548): PageHelper::prepareBlocks(SiteController, array("menu_left" => stdClass, "content2" => stdClass, "menu_left2" => stdClass, "content_footer_seo" => stdClass))
543             }
544 
545             try {
546 
547                 //получаем вектор с заполненными переменными шаблона
548                 $preparedBlocks = CMap::mergeArray($preparedBlocks, PageHelper::prepareBlocks($this, $data['blocks']));
549             } catch (CException $e) {
550 
551                 if (($e instanceof CHttpException) && 404 == $e->statusCode && !$this->_is404Call) {
552                     $this->render404Page();
553                 } /* else if (!YII_DEBUG) {
#3
+
 /var/www/elitih/elit.ua/protected/controllers/SiteController.php(96): SiteController->renderContent(array("id" => "150", "structure_id" => "000001000004000001000002", "template_id" => "2", "alias" => "view", ...), true)
091 
092         //получаем параметры восстребованной страницы
093         $page = $this->getPage();
094        // d($page);
095         //отрисовываем её
096         $html = $this->renderContent($page, true);
097 
098         //чистим код от комментариев и лишних отступов
099         $html = preg_replace('~<!--\s+.*\s+-->~', '', $html);
100         while (strpos($html, "\t") !== false)
101             $html = str_replace("\t", '', $html);
2024-03-29 06:59:06 Apache Yii Framework/1.1.25