大家好,我已经在 cakephp 2.x 框架中开发了一个应用程序。我使用以下代码编写了用于更新和保存到数据库中的代码:
public function editpackage($id=null)
{
$this->layout='dashboard';
$this->loadModel('Survay');
if (!$id) {
throw new NotFoundException(__('Your request is invalid'));
}
$get_survay_id = $this->Survay->findById($id);
if (!$get_survay_id) {
throw new NotFoundException(__('Your request is invalid'));
}
if ($this->request->is(array('post', 'put'))) {
$this->Survay->id = $id;
$this->request->data['Survay']['modifydate']=DboSource::expression('NOW()');
if ($this->Survay->save($this->request->data)) {
$this->Session->setFlash('Your Survay is successfully updated','default',array('class'=>'alert alert-success'));
return $this->redirect(array('controller'=>'Users','action'=>'detailspackage'));
}
}
if (!$this->request->data) {
$this->request->data = $get_survay_id;
}
}
我正进入(状态 :
Non-static method DboSource::expression() should not be called statically, assuming $this from incompatible context