How to update multiple records from array in cakePHP 4

I have an array where i have id and status that need to update.

same thing i did in cakePHP 2.x easily using this code

$data = [
   ['id' => 1, 'status' =>1],
    ['id' => 2, 'status' => 2],
    ['id' => 3, 'status' => 2],
    ['id' => 4, 'status' => 1],
    ['id' => 5, 'status' => 2],
];
/* ID is primary id so it will update record */
$this->Comment->saveAll($data);

But in cakePHP 4.x I am facing issue.

I am trying this code

$data = [
   ['id' => 1, 'status' =>1],
    ['id' => 2, 'status' => 2],
    ['id' => 3, 'status' => 2],
    ['id' => 4, 'status' => 1],
    ['id' => 5, 'status' => 2],
];

$ent = $this->Applications->patchEntities($data);
$res = $this->Applications->saveMany($ent);

here getting this error message

Too few arguments to function Cake\ORM\Table::patchEntities(), 1 passed in /Applications/MAMP/htdocs/cake/my_app/src/Controller/CronsController.php on line 170 and at least 2 expected

Thanks

patchEntities does indeed expect two arguments, an array of entities to patch and the data to patch them with. Are you looking for newEntities, which creates fresh entities, or do you need to use find to load the existing entities to pass to patchEntities?

Hi @Zuluru I want to update record. like in array you can see i want to update status for record.

I did this, Please let me know if have other or better solution

if (!empty($data)) {
 $chkApp = $this->Applications->find()->where(['id IN' => $app_ids])->all();
 $appEnt = $this->Applications->patchEntities($chkApp, $data, ['validate' => false]);
 $res = $this->Applications->saveMany($appEnt);
}