从蛋糕php中的字符串数组获取值

时间:2017-08-03 10:20:32

标签: php cakephp query-builder cakephp-3.x

如果我有这个数组的输出:

$array_to_delete =
[ 
    (int) 3 => (int) 4,
    (int) 4 => (int) 5 
]

我希望得到4和5等等在哪里条件,就像那样:

 $warehouseItemsData = $this->WarehouseEmployers->WarehouseItems->find()
    ->where(['id', $array_to_delete])
    ->all();

我该怎么做?在蛋糕PHP

1 个答案:

答案 0 :(得分:1)

使用IN

$warehouseItemsData = $this->WarehouseEmployers->WarehouseItems->find()
    ->where(['id IN', $array_to_delete])
    ->all();