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


PHP QueryException::invalidParameterPosition方法代碼示例

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


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

示例1: execute

 /**
  * Executes the query.
  *
  * @param string $params Any additional query parameters.
  * @param integer $hydrationMode Processing mode to be used during the hydration process.
  * @return mixed
  */
 public function execute($params = array(), $hydrationMode = null)
 {
     // If there are still pending insertions in the UnitOfWork we need to flush
     // in order to guarantee a correct result.
     //TODO: Think this over. Its tricky. Not doing this can lead to strange results
     //      potentially, but doing it could result in endless loops when querying during
     //      a flush, i.e. inside an event listener.
     if ($this->_em->getUnitOfWork()->hasPendingInsertions()) {
         $this->_em->flush();
     }
     if ($hydrationMode !== null) {
         $this->setHydrationMode($hydrationMode);
     }
     if ($params) {
         $this->setParameters($params);
     }
     if (isset($this->_params[0])) {
         throw QueryException::invalidParameterPosition(0);
     }
     // Check result cache
     if ($this->_useResultCache && ($cacheDriver = $this->getResultCacheDriver())) {
         $id = $this->_getResultCacheId();
         $cached = $this->_expireResultCache ? false : $cacheDriver->fetch($id);
         if ($cached === false) {
             // Cache miss.
             $stmt = $this->_doExecute();
             $result = $this->_em->getHydrator($this->_hydrationMode)->hydrateAll($stmt, $this->_resultSetMapping, $this->_hints);
             $cacheDriver->save($id, $result, $this->_resultCacheTTL);
             return $result;
         } else {
             // Cache hit.
             return $cached;
         }
     }
     $stmt = $this->_doExecute();
     if (is_numeric($stmt)) {
         return $stmt;
     }
     return $this->_em->getHydrator($this->_hydrationMode)->hydrateAll($stmt, $this->_resultSetMapping, $this->_hints);
 }
開發者ID:jacques-sounvi,項目名稱:addressbook,代碼行數:47,代碼來源:AbstractQuery.php

示例2: execute

 /**
  * Executes the query.
  *
  * @param string $params Any additional query parameters.
  * @param integer $hydrationMode Processing mode to be used during the hydration process.
  * @return mixed
  */
 public function execute($params = array(), $hydrationMode = null)
 {
     // If there are still pending insertions in the UnitOfWork we need to flush
     // in order to guarantee a correct result.
     if ($this->_em->getUnitOfWork()->hasPendingInsertions()) {
         $this->_em->flush();
     }
     if ($hydrationMode !== null) {
         $this->_hydrationMode = $hydrationMode;
     }
     $params = $this->getParameters($params);
     if (isset($params[0])) {
         throw QueryException::invalidParameterPosition(0);
     }
     // Check result cache
     if ($this->_useResultCache && ($cacheDriver = $this->getResultCacheDriver())) {
         $id = $this->getResultCacheId($params);
         $cached = $this->_expireResultCache ? false : $cacheDriver->fetch($id);
         if ($cached === false) {
             // Cache miss.
             $stmt = $this->_doExecute($params);
             $result = $this->_em->getHydrator($this->_hydrationMode)->hydrateAll($stmt, $this->_resultSetMapping, $this->_hints);
             $cacheDriver->save($id, $result, $this->_resultCacheTTL);
             return $result;
         } else {
             // Cache hit.
             return $cached;
         }
     }
     $stmt = $this->_doExecute($params);
     if (is_numeric($stmt)) {
         return $stmt;
     }
     return $this->_em->getHydrator($this->_hydrationMode)->hydrateAll($stmt, $this->_resultSetMapping, $this->_hints);
 }
開發者ID:nvdnkpr,項目名稱:symfony-demo,代碼行數:42,代碼來源:AbstractQuery.php

示例3: execute

 /**
  * Executes the query.
  *
  * @param array $params Any additional query parameters.
  * @param integer $hydrationMode Processing mode to be used during the hydration process.
  * @return mixed
  */
 public function execute($params = array(), $hydrationMode = null)
 {
     if ($hydrationMode !== null) {
         $this->setHydrationMode($hydrationMode);
     }
     if ($params) {
         $this->setParameters($params);
     }
     if (isset($this->_params[0])) {
         throw QueryException::invalidParameterPosition(0);
     }
     // Check result cache
     if ($this->_useResultCache && ($cacheDriver = $this->getResultCacheDriver())) {
         list($key, $hash) = $this->getResultCacheId();
         $cached = $this->_expireResultCache ? false : $cacheDriver->fetch($hash);
         if ($cached === false || !isset($cached[$key])) {
             // Cache miss.
             $stmt = $this->_doExecute();
             $result = $this->_em->getHydrator($this->_hydrationMode)->hydrateAll($stmt, $this->_resultSetMapping, $this->_hints);
             $cacheDriver->save($hash, array($key => $result), $this->_resultCacheTTL);
             return $result;
         } else {
             // Cache hit.
             return $cached[$key];
         }
     }
     $stmt = $this->_doExecute();
     if (is_numeric($stmt)) {
         return $stmt;
     }
     return $this->_em->getHydrator($this->_hydrationMode)->hydrateAll($stmt, $this->_resultSetMapping, $this->_hints);
 }
開發者ID:Niggu,項目名稱:cloudrexx,代碼行數:39,代碼來源:AbstractQuery.php


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