I have an ArrayDataProvider of Items, returned by a function of the following form:
public function builder() {
$items = Item::find()->all();
$dataProvider = new ArrayDataProvider([
'allModels' => $items,
'pagination' => false,
'id' => 'items_dp'
]);
return $dataProvider;
}
For various reasons, I need the code for this function to stay as it is.
My question is, if I have a list of Item ids, myItemIds, is there any way to rapidly select Items in the DataProvider having those ids one by one?
For example, in an application like:
$provider = builder();
$myItemIds = [112,321,422];
$superItems = [];
foreach ($myItemIds->each() as $itemId) {
$superItem = // builder based on data from the Item in DataProvider with id = $itemId and other things;
$superItems[] = $superItem;
}