Hi guys,
I’m a little surprised at parameter given to method by following code. I assume an integer, but I get an array. Of course, it’s simple to fix it, nevertheless, my intention is to understand, why I will get an array instead an integer. Who knows about it?
public function actionDeleteall() {
$arrayOfPk = array();
$model = Mail::find()->all();
foreach ($model as $item) {
array_push($arrayOfPk, $item->id);
}
for ($i = 0; $i < count($arrayOfPk); $i++) {
//$arrayOfPk[$i] will be integer, as var_dump shows up, but....
$this->actionDelete([$arrayOfPk[$i]]);
}
}
…here, I will get an array
public function actionDelete($id) {
if (is_array($id))
$id = $id[0];
.
.