PHP warning

count(): Parameter must be an array or an object that implements Countable

/home/sapore/public_html/protected/models/Contents.php(178)

166          * @param type $sectionId
167          * @param type $onlyActive
168          * @return type 
169          */
170         public static function getContentListBySectionId($sectionId, $onlyActive = true, $withPreview = false){
171             $query = "SELECT * FROM `contents` ";
172             if($onlyActive) $query.= " where status = 1 ";
173             $query.= " and sectionId = '".$sectionId."' ";
174             $query.= " order by date desc ";
175             
176             $items= Contents::model()->findAllBySql($query);
177             
178             if(count($items > 0))   
179                 return $items;
180             else
181                 return null;
182         }
183         
184         public static function getFirstContentBySectionId($sectionId){
185             $query = "SELECT * FROM `contents` ";
186             $query.= " where status = 1 ";
187             $query.= " and sectionId = '".$sectionId."' ";
188             $query.= " order by date desc ";
189             $query.= " limit 1 ";
190             

Stack Trace

#0
+
 /home/sapore/public_html/protected/controllers/SiteController.php(88): Contents::getContentListBySectionId(8, true, true)
83                 $this->render('error', $error);
84             }
85         }
86         
87         private function renderSectionListView($sectionId, $viewName = 'section', $withGalleryPreview = false){
88             $items = Contents::getContentListBySectionId($sectionId, TRUE, TRUE);
89             $itemsThumbs = array();
90             foreach ($items as $item) {
91                 if($item["gallery_id"] == null){
92                     array_push($itemsThumbs, null);
93                 }else{
#1
+
 /home/sapore/public_html/protected/controllers/SiteController.php(50): SiteController->renderSectionListView(8, "how")
45             $this->renderSectionView(4);
46     }
47         
48         public function actionHow()
49     {
50             $this->renderSectionListView(8, 'how');
51         }
52         
53         public function actionProducts()
54     {
55             $this->renderSectionView(7, 'products', true);
#9
+
 /home/sapore/public_html/index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11 
12 require_once($yii);
13 Yii::createWebApplication($config)->run();
2024-03-28 22:17:07 LiteSpeed Yii Framework/1.1.13