foreach() argument must be of type array|object, null given Yii2, gives error 500 when i click view button
$variableConfig = Yii::$app->session->get($this->createModel->getKeyVariables());
$browserVariables = [];
$columns = [];
if($entity != 'activity'){
array_push($browserVariables, [
'abbrev' => 'DESIGNATION',
'name' => 'activity',
'label' => 'activity'
]);
}
//Error foreach here gives me error 500, thank you
foreach($variableConfig AS $variable){
if( $variable['entity'] == $entity && $variable['type'] != 'attribute' && (
$variable['entity'] != 'activity' || ($variable['entity'] == 'activity' && $variable['type'] != 'attribute'))){
array_push($browserVariables, [
'abbrev' => $variable['abbrev'],
'name' => $variable['variable_info']['name'],
'label' => $variable['variable_info']['label']
]);
}
}