PHP warning

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

/var/www/html/protected/controllers/SiteController.php(13941)

13929         $data = kaushalaajivikaemployerdata($page, $limit,$type,$district);
13930         $data = json_decode($data);
13931 
13932         // $filters = Yii::app()->request->getParam('filter', array());
13933         // $filteredData = applyFilters($data->data, $filters);
13934         // print_r($filteredData);exit;
13935         $dataProvider = new CArrayDataProvider($data->data, [
13936             'keyField' => 'company_name',
13937             'pagination' => [
13938                 'pageSize' => $limit,
13939                 'currentPage' => $page - 1, // CArrayDataProvider is 0-based
13940             ],
13941             'totalItemCount' => $data->total ?? count($data->data),
13942 
13943         ]);
13944         // echo "<pre>";
13945         // print_r($dataProvider->getData());exit;
13946 
13947 
13948 
13949         $this->render(
13950             'getKAEmployerList',
13951             [
13952                 'dataProvider' => $dataProvider,
13953                 'pageSize' => $limit,

Stack Trace

#7
+
 /var/www/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();
2026-07-22 02:11:56 Apache/2.4.54 (Debian) Yii Framework/1.1.20