コードの最初のブロックはエラーをスローしますFatal error: Class 'DboSource' not found
が、コードの 2 番目のブロックは問題なく動作します。これは私を打ち負かします、両方とも同じ行を使用して作成されたフィールドを保存します...ブロック1
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'));
}