public function validate($attributeNames = null, $clearErrors = true){ if(parent::validate($attributeNames, $clearErrors)){ Auction::infoLog('Model :: ' . self::className() . ' Has Successfully Validated ', $this->getAttributes()); return true; }else{ Auction::errorLog('Model record :: '. self::className() .' not validated ',$this->getErrors()); return false; } }
private function setUserFlash($message){ $session = Auction::$app->session; $session->setFlash('activate-status' , $message); Auction::errorLog('User Activation', $session->getAllFlashes()); }
public function updateAuction($request){ $transaction = Auction::$app->db->beginTransaction(); try{ }catch (Exception $ex){ $transaction->commit(); Auction::errorLog('Auction Not Updated '.$ex->getMessage(),$request); throw new HttpException(500 , 'DataBase Error'); } }
/** Update Auction */ public static function UpdateAuction($event){ $sender = $event->sender; $data = $event->data; if($sender->load($data) && $sender->bidsTerms->load($data) && $sender->auctionsCriterias->load($data) && $sender->auctionPreferences->load($data)){ $transaction = \Yii::$app->db->transaction; try{ $sender->save(); /*if($sender->bidsTerms->update() === false){ return false; } if($sender->auctionsCriterias->update() === false){ return false; } if($sender->auctionPreferences->update() === false){ return false; }*/ $transaction->commit(); return true; }catch (Exception $ex){ print_r($ex->getMessage());die; //$transaction->rollBack(); Auction::errorLog('Auction Update Error'. $ex->getMessage(), $data); throw new HttpException(500 ,'Internal Sever Error'); } } }