Exemplo n.º 1
0
 public function createTransaction($data)
 {
     $transaction = new Btransaction();
     $transaction->amount = isset($data['amount']) ? (int) $data['amount'] : 100;
     $transaction->id_user = Yii::app()->user->id;
     $transaction->id_operation = 1;
     $transaction->time_start = time();
     if ($transaction->save()) {
         return $transaction;
     } else {
         print_r($transaction->getErrors());
         die;
         throw new CHttpException(404, 'Ошибка при создании транзакции');
     }
 }