Answer the question
In order to leave comments, you need to log in
Why does Yii2 return 502 error?
returns 502 when calling this function.
public function actionPravka()
{
$session = new Session;
$session = Yii::$app->session;
$group = Taxon::find()->orderBy(['rang_id' => SORT_ASC])->all();
foreach($group as $k=>$item) {
// открываем сессию
$session->open();
$session->set('value', round(++$k * 100 / count($group), 2, PHP_ROUND_HALF_UP));
if($item->rang_id == 4) {
//$family = Taxon::find()->where(['id' => $item->parent_id])->all();
$klass_id = Taxon::find()->where(['id' => $item->parent_id])->all();
$otdel_id = Taxon::find()->where(['id' => $klass_id[0]['parent_id']])->all();
$customer3 = Taxon::findOne($item->id);
$customer3->klass_id = $klass_id[0]['id'];
$customer3->otdel_id = $otdel_id[0]['id'];
$customer3->update();
}
// закрываем сессию
$session->close();
}
// уничтожаем все данные сессии
$session->destroy();
echo 'Обновлено';
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question