Код: Выделить всё
$products = Product::find()
->where('in', 'id', [1, 2, 3, 4, 5, 6, 7, 8, 11, 19, 14, 20]);
Код: Выделить всё
$pagination = new Pagination([
'defaultPageSize' => 10,
'totalCount' => $products->count(),
]);
$products = $products->offset($pagination->offset)
->limit($pagination->limit)
->all();
Invalid argument supplied for foreach()
и подчеркивает строку в коде:
Код: Выделить всё
'totalCount' => $products->count(),
Я хочу выбрать товары, и показать их с пагинацией. Что я делаю не так?
А если поменяют запрос на:
Код: Выделить всё
$products = Product::findAll([1, 2, 3, 4, 5, 6, 7, 8, 11, 19, 14, 20]);
Код: Выделить всё
Call to a member function count() on a non-object