Entityを保存する場合、1レコード作成する方法と複数レコード作成する方法が違うため、メモ
バージョン
CakePHP 3.5
PHP 7.2
新規保存
1レコード作成する方法
UsersController.php
public function add()
{
if ($this->request->is('post') {
$entity = $this->newEntity($this->request->getData());
$this->save($entity);
}
}
複数レコード作成する方法
UsersController.php
public function add()
{
if ($this->request->is('post') {
$entities = $this->newEntities($this->request->getData());
$this->saveMany($entities);
}
}