當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DibiConnection::begin方法代碼示例

本文整理匯總了PHP中DibiConnection::begin方法的典型用法代碼示例。如果您正苦於以下問題:PHP DibiConnection::begin方法的具體用法?PHP DibiConnection::begin怎麽用?PHP DibiConnection::begin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DibiConnection的用法示例。


在下文中一共展示了DibiConnection::begin方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: store

 /**
  * Store authorization code
  * @param IAuthorizationCode $authorizationCode
  * @throws InvalidScopeException
  */
 public function store(IAuthorizationCode $authorizationCode)
 {
     $this->context->insert($this->getTable(), array('authorization_code' => $authorizationCode->getAuthorizationCode(), 'client_id' => $authorizationCode->getClientId(), 'user_id' => $authorizationCode->getUserId(), 'expires_at' => $authorizationCode->getExpires()))->execute();
     $this->context->begin();
     try {
         foreach ($authorizationCode->getScope() as $scope) {
             $this->context->insert($this->getScopeTable(), array('authorization_code' => $authorizationCode->getAuthorizationCode(), 'scope_name' => $scope))->execute();
         }
     } catch (\PDOException $e) {
         // MySQL error 1452 - Cannot add or update a child row: a foreign key constraint fails
         if (in_array(1452, $e->errorInfo)) {
             throw new InvalidScopeException();
         }
         throw $e;
     }
     $this->context->commit();
 }
開發者ID:drahak,項目名稱:oauth2,代碼行數:22,代碼來源:AuthorizationCodeStorage.php

示例2: refreshToken

 /**
  * @inheritDoc
  */
 function refreshToken($refreshToken)
 {
     $this->purgeOldTokens();
     $token = $this->refreshTokenToToken($refreshToken);
     $this->dbConnection->begin();
     // Check for existing token and lock it
     $existingToken = $this->dbConnection->query('SELECT * FROM %n', $this->tableName, 'WHERE [token] = %s', $token, 'FOR UPDATE')->fetch();
     // No matching token found
     if ($existingToken === FALSE) {
         $this->dbConnection->rollback();
         return FALSE;
     }
     $newToken = $this->generateNewToken();
     $dt = new \DateTime();
     $dt->modify("+" . $this->tokenTtl . " seconds");
     $this->dbConnection->query('UPDATE %n', $this->tableName, 'SET [token] = %s,', $newToken, '[expires] = %t', $dt, 'WHERE [token] = %s', $token);
     $this->dbConnection->commit();
     return new Token($newToken, $this->tokenTtl, $this->generateRefreshToken($newToken), $existingToken->parameters);
 }
開發者ID:vbuilder,項目名稱:framework,代碼行數:22,代碼來源:DatabaseTokenManager.php

示例3: begin

 /**
  * Begin transaction
  * @param null $savepoint
  *
  * @throws \DibiException
  */
 public function begin($savepoint = NULL)
 {
     $this->database->begin($savepoint);
 }
開發者ID:bombush,項目名稱:NatsuCon,代碼行數:10,代碼來源:EntityModel.php

示例4: begin

 /**
  * Vytvoří novou transakci
  * @param string $savepoint
  * @throws \DibiException
  */
 public function begin($savepoint = NULL)
 {
     $this->connection->begin($savepoint);
 }
開發者ID:JZechy,項目名稱:ZBox,代碼行數:9,代碼來源:DbUtils.php


注:本文中的DibiConnection::begin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。