everyone. I have a problem with patchEntities. I want to edit entities by using form.
- Edit a entities by using form (view)
- Send the data (view)
- apply data by using patchEntities (controller)
However, I get an error when I try to patchEntities.
Table Name: tempTable
column: id, name, age
Controller
$data = $this->table->find('all');
if($this->request->is(['post'])){
$entities = $table->patchEntities($data->toArray(), $this->request->data());
}
$this->set(compact('data'));
View
<?= $this->Form->Create('tempTable');?>
<?php foreach ($data as $key=>$d): ?>
<?= $this->Form->Control($key.'.name', ['type' => 'text', 'default' => $d->name]);?>
<?php endforeach; ?>
<?= $this->Form->submit('submit');?>
<?= $this->Form->end();?>
I got an error "Call to member function patchEntities() on boolean"
I can't understand why I get the error.
Could you give me a hint?
Thank you very much.