Example #1
0
 /**
  * Transaction aroud advice
  *
  * @param array                 $values
  * @param BEAR_Aspect_JoinPoint $joinPoint
  *
  * @return array
  */
 public function around(array $values, BEAR_Aspect_JoinPoint $joinPoint)
 {
     // pre process
     $obj = $joinPoint->getObject();
     $db = $obj->getDb();
     $db->beginTransaction();
     // proceed original method
     $result = $joinPoint->proceed($values);
     // post process
     if (!MDB2::isError($result)) {
         $db->commit();
     } else {
         $db->rollback();
     }
     return $result;
 }
Example #2
0
 /**
  * Timer aroudアドバイス
  *
  * @param array $values
  *
  * @return array
  */
 public function around(array $values, BEAR_Aspect_JoinPoint $joinPoint)
 {
     // 前処理
     $obj = $joinPoint->getObject();
     $db = $obj->getDb();
     $db->beginTransaction();
     // オリジナルのメソッドを実行
     $result = $joinPoint->proceed($values);
     // 後処理
     if (!MDB2::isError($result)) {
         $db->commit();
     } else {
         $db->rollback();
     }
     return $result;
 }