BeforeSave не срабатывает при сохранении объектаPhp

Кемеровские программисты php общаются здесь
Anonymous
BeforeSave не срабатывает при сохранении объекта

Сообщение Anonymous »

я пытаюсь использовать Cakephp версии 3.10 для запуска события beforeSave, но оно ничего не делает.
Это единственный контроллер/таблица, который этого не делает
Контроллер

Код: Выделить всё

public function edit($id = null)
{
$company = $this->Companies->get($id, [
'contain' => [],
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$company = $this->Companies->patchEntity($company, $this->request->getData());
if ($this->Companies->save($company)) {
$this->Flash->success(__('The company has been saved.'));

return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The company could not be saved.  Please, try again.'));
}
$users = $this->Companies->Users->find('list', ['limit' => 200]);
$this->set(compact('company', 'users'));
}
Таблица:

Код: Выделить всё


Подробнее здесь: [url]https://stackoverflow.com/questions/78680287/beforesave-is-not-firing-when-saving-entity[/url]

Вернуться в «Php»