0

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

ndm
  • 59,784
  • 9
  • 71
  • 110
Dina Shaldoum
  • 71
  • 1
  • 8
  • Possible duplicate of [CakePHP how to get multiple rows by array of ID's](https://stackoverflow.com/questions/6819865/cakephp-how-to-get-multiple-rows-by-array-of-ids) – Sarkouille Aug 03 '17 at 10:27

1 Answers1

1

use IN

$warehouseItemsData = $this->WarehouseEmployers->WarehouseItems->find()
    ->where(['id IN', $array_to_delete])
    ->all();
arilia
  • 9,373
  • 2
  • 20
  • 44