SHARE
TWEET

Untitled

qwertyR13 Dec 28th, 2018 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Call to a member function getArticleComments() on null
  2. 1. in /var/www/example.com/basic/controllers/SiteController.php at line 143                    
  3.  
  4.  
  5.     public function actionView($id)
  6.     {
  7.         $article = Article::findOne($id);
  8.         $popular = Article::getPopular();
  9.         $recent = Article::getRecent();
  10.         $categories = Category::getAll();
  11.         $comments = $article->getArticleComments();   -- line 143  
  12.         $commentForm = new CommentForm();
  13.         $article->viewedCounter();
  14.  
  15.         return $this->render('single',[
  16.             'article'=>$article,
  17.             'popular'=>$popular,
  18.             'recent'=>$recent,
  19.             'categories'=>$categories,
  20.             'comments'=>$comments,
  21.      //          
  22. Трассировка стека:
  23.  
  24. Error: Call to a member function getArticleComments() on null in /var/www/example.com/basic/controllers/SiteController.php:143
  25. Stack trace:
  26. #0 [internal function]: app\controllers\SiteController->actionView('845')
  27. #1 /var/www/example.com/basic/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
  28. #2 /var/www/example.com/basic/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
  29. #3 /var/www/example.com/basic/vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller->runAction('view', Array)
  30. #4 /var/www/example.com/basic/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction('site/view', Array)
  31. #5 /var/www/example.com/basic/vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest(Object(yii\web\Request))
  32. #6 /var/www/example.com/basic/web/index.php(12): yii\base\Application->run()
  33. #7 {main}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top