Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How to load several Models with an array of id's


I've got an array with ids I want to load. I tried the following but the result was always the product with the first id from $productstoload:

//$productstoload is the array with the ids

$products = Product::find([
                    '$or' => $productstoload

Thank you for your help!

edited Jul '18

Hi @campinony you have to use

$products = Product::find([
    'conditions' => 'id in ({ids:array-int})'
    'bind' => [
        'ids' => $productstoload

Good luck

Thanks a lot!