Answer the question
In order to leave comments, you need to log in
How to fix a bug after updating php 7 and Yii2?
Guys please help, I'm weak...
There is a code that saves the selected products:
// сохраняем открытые продукты
foreach ($this->openProducts as $keyIdProj => $projProdOpen) {
foreach ($projProdOpen as $key => $value) {
for ($x = 0; $x < count(array($value)); $x++) {
if (!$value[$x]) {
continue;
}
$rec = new ProductsOpen();
$rec->id_user = $this->id;
$rec->id_product = $value[$x];
$rec->save();
if ($rec->errors) {
//var_dump($rec->errors);
exit();
}
$openProduct[] = $rec;
}
}
}
array (size=3)
1 =>
array (size=2)
'products' => string '' (length=0)
'packs' => string '' (length=0)
2 =>
array (size=2)
'products' =>
array (size=3)
0 => string '175' (length=3)
1 => string '176' (length=3)
2 => string '186' (length=3)
'packs' => string '' (length=0)
3 =>
array (size=2)
'products' => string '' (length=0)
'packs' => string '' (length=0)
foreach ($this->openProducts as $keyIdProj => $projProdOpen) {
var_dump($projProdOpen); exit;
array (size=2)
'products' => string '' (length=0)
'packs' => string '' (length=0)
foreach ($projProdOpen as $key => $value) {
var_dump($value); exit;
:138:string '' (length=0)
for ($x = 0; $x < count($value); $x++) {
array (size=3)
1 =>
array (size=2)
'products' => string '' (length=0)
'packs' => string '' (length=0)
2 =>
array (size=2)
'products' =>
array (size=3)
0 => string '175' (length=3)
1 => string '176' (length=3)
2 => string '182' (length=3)
'packs' => string '' (length=0)
3 =>
array (size=2)
'products' =>
array (size=1)
0 => string '214' (length=3)
'packs' => string '' (length=0)
array (size=3)
1 =>
array (size=2)
'products' =>
array (size=5)
0 => string '150' (length=3)
1 => string '166' (length=3)
2 => string '149' (length=3)
3 => string '169' (length=3)
4 => string '181' (length=3)
'packs' => string '' (length=0)
2 =>
array (size=2)
'products' =>
array (size=5)
0 => string '175' (length=3)
1 => string '176' (length=3)
2 => string '182' (length=3)
3 => string '183' (length=3)
4 => string '185' (length=3)
'packs' => string '' (length=0)
3 =>
array (size=2)
'products' =>
array (size=1)
0 => string '214' (length=3)
'packs' => string '' (length=0)
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