Is there a more efficient way to delete multiple objects with id
$data = $this->request->data ['missing_lexicon_id']; foreach ( $data as $id ) { $missingLexicon = $this->MissingLexicons->get ( $id ); $this->MissingLexicons->delete ( $missingLexicon ) }
This should work
$this->MissingLexicons->deleteAll(['MissingLexicons.column IN' => $keys]);
Where $ keys is an array with identifiers to be deleted.
The most efficient way to delete multiple objects with deleteALL () .
$this->MissingLexicons->deleteAll(['id IN' => $multiItemsArray]);
OR
$this->MissingLexicons->deleteAll(['id' => $multiItemsArray[]]);
MissingLexicons = the name of your model.$ multiItemsArray = Deleted id objects
MissingLexicons = the name of your model.
$ multiItemsArray = Deleted id objects
More here