I’m not sure what I was thinking when I originally posted the code above. Obviously that portion of my code returns 101, but it is the
Model::loadMultiple($modelsDrivers, Yii::$app->request->post());
that return 101 as well, where it should be seeing my addition(s)
The full code block is
$oldDriverIds = ArrayHelper::map($modelsDrivers, 'DriverId', 'DriverId');
$modelsDrivers = Model::createMultipleClientDrivers(ClientsDrivers::class, $modelsDrivers);
Model::loadMultiple($modelsDrivers, Yii::$app->request->post());
$deletedDriverIds = array_diff($oldDriverIds, array_filter(ArrayHelper::map($modelsDrivers, 'DriverId', 'DriverId')));
It as if the loadMultiple isn’t getting the additions?
If I add the record via SQL they do indeed show through the web application, but the second I save the record they are deleted after the 101st one.
The dynamic for has a limit of 250, so that shouldn’t be the issue.
I tested to see what is making it’s way to the Controller for processing using
VarDumper::dump(Yii::$app->request->post('ClientsDrivers'), 10, true);
and I get back
...
99 => [
'DriverId' => '42'
'FirstName' => 'John'
'LastName' => 'Doe'
'Cell' => '(666) 666-6666'
'TruckNo' => '66-81269'
'Active' => '1'
]
100 => [
'DriverId' => '153'
]
]
An Error occurred while handling another error:
yii\web\HeadersAlreadySentException: Headers already sent in D:\home\site\vendor\yiisoft\yii2\helpers\BaseVarDumper.php on line 38. in D:\home\site\vendor\yiisoft\yii2\web\Response.php:366
Stack trace:
#0 D:\home\site\vendor\yiisoft\yii2\web\Response.php(339): yii\web\Response->sendHeaders()
#1 D:\home\site\vendor\yiisoft\yii2\web\ErrorHandler.php(136): yii\web\Response->send()
#2 D:\home\site\vendor\yiisoft\yii2\base\ErrorHandler.php(135): yii\web\ErrorHandler->renderException(Object(yii\web\HeadersAlreadySentException))
#3 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\HeadersAlreadySentException))
#4 {main}
Previous exception:
yii\web\HeadersAlreadySentException: Headers already sent in D:\home\site\vendor\yiisoft\yii2\helpers\BaseVarDumper.php on line 38. in D:\home\site\vendor\yiisoft\yii2\web\Response.php:366
Stack trace:
#0 D:\home\site\vendor\yiisoft\yii2\web\Response.php(339): yii\web\Response->sendHeaders()
#1 D:\home\site\vendor\yiisoft\yii2\base\Application.php(392): yii\web\Response->send()
#2 D:\home\site\wwwroot\admin\index.php(17): yii\base\Application->run()
#3 {main}
How can it process 100 and then suddenly have a HeadersAlreadySentException?