Cakephp 3 table updateAll using array

In Cakephp 2's model updateAll, we were using arrays as conditions. But this doesn't work :

$data=array(12, 22, 44);
   array("checked" => 1),
   array("user_id" => $data) 

Is this not possible in Cakephp 3's updateAll ?

This works in cakephp 3:

   array("checked" => 1),
   array("user_id" => $data) 

Regarding to API docs, $conditions defined like this:

updateAll( array $fields , mixed $conditions )

array $fields
A hash of field => new value.

mixed $conditions
Conditions to be used, accepts anything Query::where() can take.

Edit: In case of cake works well and I'm making a mistake. How can I understand the cause ? Because when condition is an integer, code works well.

Edit2: This also works well:

 $data=array(12, 22, 44);
 ConnectionManager::get('default')->query('UPDATE foobars SET checked=1 
     WHERE user_id IN ('.implode(",",$data).')')->execute();


It does work, as explained in the docs:

A little late to the discussion, but since I had a similar problem, using something like id in array condition, this is how is done now on Cakephp 3.

//using the same example
$data=array(12, 22, 44);

   ["checked" => 1],
   ["user_id IN " => $data] //mind the IN on the condition

Here is another way from the docs, updated for the example

$articles = TableRegistry::get('Articles');
$data=array(12, 22, 44);

$query = $articles->query();
    ->set(['checked' => true])
    ->where(['user_id IN' => $data])

Hope it helps someone else.

Need Your Help

Cordova Geolocation plugin in ripple

cordova cordova-plugins visual-studio-cordova ripple

I added cordova-plugin-geolocation to my cordova app in VS 2015. For some reason Ripple seems not to support it. I get this error: