当前位置: 首页>>代码示例>>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;未经允许,请勿转载。