通过id Cakephp3删除多个实体

Mon*_*One 7 cakephp-3.0

是否有更有效的方法通过id删除多个实体

$data = $this->request->data ['missing_lexicon_id'];
foreach ( $data as $id ) {
    $missingLexicon = $this->MissingLexicons->get ( $id );
    $this->MissingLexicons->delete ( $missingLexicon )
}
Run Code Online (Sandbox Code Playgroud)

Ale*_*len 5

这应该工作

$this->MissingLexicons->deleteAll(['MissingLexicons.column IN' => $keys]);
Run Code Online (Sandbox Code Playgroud)

其中$ keys是一个包含要删除的ID的数组.