public function index()
{
if ($this->getRequest()->is('post')) {
$this->Products->updateProducts($this->getRequest()->getData());
}
// some more actions
}
ProductsTable
public function updateProducts(array $entries)
{
$products = $this->find()->toArray();
$entities = $this->patchEntities($products, $entries);
return $this->saveMany($entities);
}
You’re not checking the results of any of your single-entity saves. Any chance that one (or more) of them are failing? That would cause the saveMany to not save anything, I think.
according to docs Saving Data - 4.xsaveMany() should return entities or false, in your case it seems like array not object. Try to debug $entities after patch and check for errors and check if they are entities there.
You can also look for SQL history in debug bar to check if there was any saves.
I’m using mostly 3.1 version and there was no saveMany() but there was patchEntities() and it was working for many rows forms, using convention like @ADmad propose.