PHP warning

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

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

13901         $data = kaushalaajivikaemployerdata($page, $limit,$type,$district);
13902         $data = json_decode($data);
13903 
13904         // $filters = Yii::app()->request->getParam('filter', array());
13905         // $filteredData = applyFilters($data->data, $filters);
13906         // print_r($filteredData);exit;
13907         $dataProvider = new CArrayDataProvider($data->data, [
13908             'keyField' => 'company_name',
13909             'pagination' => [
13910                 'pageSize' => $limit,
13911                 'currentPage' => $page - 1, // CArrayDataProvider is 0-based
13912             ],
13913             'totalItemCount' => $data->total ?? count($data->data),
13914 
13915         ]);
13916         // echo "<pre>";
13917         // print_r($dataProvider->getData());exit;
13918 
13919 
13920 
13921         $this->render(
13922             'getKAEmployerList',
13923             [
13924                 'dataProvider' => $dataProvider,
13925                 '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-06-06 23:49:19 Apache/2.4.54 (Debian) Yii Framework/1.1.20