PHP warning

Illegal string offset 'key'

/var/www/vhosts/mariazarzalejos.com/httpdocs/protected/controllers/SiteController.php(518)

506             foreach ($products as $key => $product) {
507                 $cats[$product->pro->marcat->mca_name][] = $product;   
508             }
509             asort($cats);
510         }
511         elseif(!empty($_GET['catname']) and $mcategory = $this->loadMarketCategory($_GET['catname'])){
512             $str = $mcategory->mca_name;
513             $criteriasel->with = array('mon'=>array('order'=>'mon_name ASC'),'pro'=>array('order'=>'pro_name ASC','condition'=>'marcat_id=:marcat_id'));
514             $criteriasel->params =  array(':marcat_id'=>$mcategory->marcat_id);
515             $products = Monthproduct::model()->findAll($criteriasel);
516             foreach ($products as $key => $product) {
517                 $obj =  '';
518                 $obj['key'] = $product->mon->mon_id;
519                 $obj['name'] = $product->mon->mon_name;   
520                 $obj['object'] = $product;   
521                 $otro[] = $obj;
522             }
523             $SMA = new SortMultiArray($otro,'key',0);
524             $mas = $SMA->GetSortedArray();
525             foreach ($mas as $key => $value) {
526                 $cats[$value['name']][]=$value['object'];
527             }
528         }else {
529             $month = Month::model()->findByPk(date('n'));
530             $str = $month->mon_name;

Stack Trace

#7
+
 /var/www/vhosts/mariazarzalejos.com/httpdocs/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',30);
11 
12 require_once($yii);
13 Yii::createWebApplication($config)->run();
2024-03-29 11:06:47 Apache Yii Framework/1.1.12