Hi
I have a finder for some categories and I want to shuffle the results and limit them.
Since I don't want to always return the first x of the results, I am not limiting in the finder itself.
My code is as follows:
PHP:
I am wondering if there is a better (built in maybe?) way to do...
Read more
Читать далее...
I have a finder for some categories and I want to shuffle the results and limit them.
Since I don't want to always return the first x of the results, I am not limiting in the finder itself.
My code is as follows:
PHP:
Код:
$categoryFinder = $this->finder('****')
->where('category_id', $categoryIds);
$categories = $categoryFinder->fetch();
$categories = $categories->shuffle();
$categories = $categories->slice(0, $limit);
I am wondering if there is a better (built in maybe?) way to do...
Read more
Читать далее...