第一個代碼塊拋出錯誤Fatal error: Class 'DboSource' not found
,而第二個代碼塊工作得很好。這甘拜下風,都使用同樣的線路,以保存創建場... 1座Cakephp - 找不到'DboSource'類
public function add() {
if ($this->request->is('post')) {
$this->request->data['created'] = DboSource::expression('NOW()');
$this->EbayAccount->create();
if ($this->EbayAccount->save($this->request->data)) {
//$this->EbayAccount->id = $this->EbayAccount->getLastInsertID();
//$this->EbayAccount->saveField('created', DboSource::expression('NOW()'));
$this->Session->setFlash(__('The ebay account has been saved'));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The ebay account could not be saved. Please, try again.'));
}
}
$this->set('userId', $this->Auth->user('id'));
}
2座
public function add() {
if ($this->request->is('post')) {
//$this->request->data['created'] = DboSource::expression('NOW()');
$this->EbayAccount->create();
if ($this->EbayAccount->save($this->request->data)) {
$this->EbayAccount->id = $this->EbayAccount->getLastInsertID();
$this->EbayAccount->saveField('created', DboSource::expression('NOW()'));
$this->Session->setFlash(__('The ebay account has been saved'));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The ebay account could not be saved. Please, try again.'));
}
}
$this->set('userId', $this->Auth->user('id'));
}