且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Codeception如何通过数组中的值获取实体

更新时间:2023-02-23 12:50:29

这是一种方法:

$arrayOfIds = [1,2,3,4,5];
$products = array();
foreach($arrayOfIds as $id){
   $products = array_merge($products, $I->grabEntitiesFromRepository(Product::class, ['id' => $id]));
}

$ products会按所有ID不断添加新产品。

$products keeps on adding new products by all IDs.