Indirect modification of overloaded element of CHttpSession has no effect
{Boy Said}
we can use $_SESSION['YiiLib']['Lee'] to store and hold data in PHP, but in Yii a kind of diff, so I will show you the code.
{Code - Not Working ... }
$defaultLabels = XXX::model()->findAllByAttributes(array('yiilib_fbPageId' => $pageId, 'yiilib_locale_id' => $userLanguage->l_id));
foreach ($defaultLabels as $defaultLabel) {
Yii::app()->session['YiiLib'][$defaultLabel->yiilib_ident] = $defaultLabel->yiilib_value;
}
if you use code like this in Yii, you will get "Indirect modification of overloaded element of CHttpSession has no effect", the main reason is CHttpSession is not working with index like ['YiiLib']['Lee'].
{Code - Working ... }
$defaultLabels = XXX::model()->findAllByAttributes(array('yiilib_fbPageId' => $pageId, 'yiilib_locale_id' => $userLanguage->l_id));
foreach ($defaultLabels as $defaultLabel) {
$localeArray[$defaultLabel->yiilib_ident] = $defaultLabel->yiilib_value;
}
Yii::app()->session['YiiLib'] = $localeArray;
Leave Comment