Dina Shaldoum
Dina Shaldoum

Reputation: 71

getting value from string array in cake php

If I have this output of an array :

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

And i want to get 4 and 5 and so on at where condition , Like that :

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

How can i do that ? in cake php

Upvotes: 0

Views: 163

Answers (1)

arilia
arilia

Reputation: 9398

use IN

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

Upvotes: 1

Related Questions