public function actionCreate() { $model = new Bidding(); if (isset($_POST['Bidding'])) { $model->attributes = $_POST['Bidding']; if ($model->save()) { $this->addMessage('Record created successfully.'); $this->redirect(array('index')); } } $this->render('update', array('model' => $model)); }
public function actionSetBid() { $model = new Bidding(); if (isset($_POST['Bidding'])) { if ($model->canUserBid($_POST['Bidding']['fk_user'])) { $model->attributes = $_POST['Bidding']; $model->created_at = $this->getCurrentDateTime(); if ($model->save()) { $this->apiResponse['success'] = true; } } else { $this->apiResponse['message'] = 'Maximum bid count exceeded'; } } $this->sendResponse(); }
/** * test that save() resets whitelist on failed save */ public function testSaveFieldListResetsWhitelistOnFailedSave() { $this->loadFixtures('Bidding'); $model = new Bidding(); $whitelist = array('title'); $model->whitelist = $whitelist; $result = $model->save(array(), array('fieldList' => array('body'))); $this->assertFalse($result); $this->assertEquals($whitelist, $model->whitelist); }