У меня есть код контроллера CakePHP, который выдает следующую ошибку «Неустранимая ошибка: вызов функции-члена create () для необъекта».
Код контроллера следующий:
if ($this->request->is('post')) {
$this->MonthlyReturn->create();
$this->MonthlyReturn->saveField('company_id', $cid); // Assign current company ID to this monthly return before saving
if ($this->MonthlyReturn->save($this->request->data)) {
$this->Session->setFlash(__('The monthly return has been saved'));
$this->redirect(array('action' => 'index'));
} else
{
$this->Session->setFlash(__('The monthly return could not be saved. Please, try again.'));
}
}
Любая помощь будет принята с благодарностью.