当前位置: 首页>>代码示例>>PHP>>正文


PHP QueryException::invalidParameterNumber方法代码示例

本文整理汇总了PHP中Doctrine\ORM\Query\QueryException::invalidParameterNumber方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryException::invalidParameterNumber方法的具体用法?PHP QueryException::invalidParameterNumber怎么用?PHP QueryException::invalidParameterNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\ORM\Query\QueryException的用法示例。


在下文中一共展示了QueryException::invalidParameterNumber方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _doExecute

 /**
  * {@inheritdoc}
  */
 protected function _doExecute()
 {
     $executor = $this->_parse()->getSqlExecutor();
     if ($this->_queryCacheProfile) {
         $executor->setQueryCacheProfile($this->_queryCacheProfile);
     }
     // Prepare parameters
     $paramMappings = $this->_parserResult->getParameterMappings();
     if (count($paramMappings) != count($this->_params)) {
         throw QueryException::invalidParameterNumber();
     }
     list($sqlParams, $types) = $this->processParameterMappings($paramMappings);
     if ($this->_resultSetMapping === null) {
         $this->_resultSetMapping = $this->_parserResult->getResultSetMapping();
     }
     return $executor->execute($this->_em->getConnection(), $sqlParams, $types);
 }
开发者ID:davidbui2,项目名称:doctrine2,代码行数:20,代码来源:Query.php

示例2: _doExecute

 /**
  * {@inheritdoc}
  */
 protected function _doExecute()
 {
     $executor = $this->_parse()->getSqlExecutor();
     // Prepare parameters
     $paramMappings = $this->_parserResult->getParameterMappings();
     if (count($paramMappings) != count($this->_params)) {
         throw QueryException::invalidParameterNumber();
     }
     $sqlParams = $types = array();
     foreach ($this->_params as $key => $value) {
         if (!isset($paramMappings[$key])) {
             throw QueryException::unknownParameter($key);
         }
         if (isset($this->_paramTypes[$key])) {
             foreach ($paramMappings[$key] as $position) {
                 $types[$position] = $this->_paramTypes[$key];
             }
         }
         if (is_object($value) && $this->_em->getMetadataFactory()->hasMetadataFor(get_class($value))) {
             $values = $this->_em->getUnitOfWork()->getEntityIdentifier($value);
             $sqlPositions = $paramMappings[$key];
             $sqlParams = array_merge($sqlParams, array_combine((array) $sqlPositions, $values));
         } else {
             foreach ($paramMappings[$key] as $position) {
                 $sqlParams[$position] = $value;
             }
         }
     }
     if ($sqlParams) {
         ksort($sqlParams);
         $sqlParams = array_values($sqlParams);
     }
     if ($this->_resultSetMapping === null) {
         $this->_resultSetMapping = $this->_parserResult->getResultSetMapping();
     }
     return $executor->execute($this->_em->getConnection(), $sqlParams, $types);
 }
开发者ID:poulikov,项目名称:readlater,代码行数:40,代码来源:Query.php

示例3: _doExecute

 /**
  * {@inheritdoc}
  */
 protected function _doExecute()
 {
     $executor = $this->_parse()->getSqlExecutor();
     // Prepare parameters
     $paramMappings = $this->_parserResult->getParameterMappings();
     if (count($paramMappings) != count($this->_params)) {
         throw QueryException::invalidParameterNumber();
     }
     $sqlParams = $types = array();
     foreach ($this->_params as $key => $value) {
         if (!isset($paramMappings[$key])) {
             throw QueryException::unknownParameter($key);
         }
         if (isset($this->_paramTypes[$key])) {
             foreach ($paramMappings[$key] as $position) {
                 $types[$position] = $this->_paramTypes[$key];
             }
         }
         if (is_object($value) && $this->_em->getMetadataFactory()->hasMetadataFor(get_class($value))) {
             if ($this->_em->getUnitOfWork()->getEntityState($value) == UnitOfWork::STATE_MANAGED) {
                 $idValues = $this->_em->getUnitOfWork()->getEntityIdentifier($value);
             } else {
                 $class = $this->_em->getClassMetadata(get_class($value));
                 $idValues = $class->getIdentifierValues($value);
             }
             $sqlPositions = $paramMappings[$key];
             $cSqlPos = count($sqlPositions);
             $cIdValues = count($idValues);
             $idValues = array_values($idValues);
             for ($i = 0; $i < $cSqlPos; $i++) {
                 $sqlParams[$sqlPositions[$i]] = $idValues[$i % $cIdValues];
             }
         } else {
             foreach ($paramMappings[$key] as $position) {
                 $sqlParams[$position] = $value;
             }
         }
     }
     if ($sqlParams) {
         ksort($sqlParams);
         $sqlParams = array_values($sqlParams);
     }
     if ($this->_resultSetMapping === null) {
         $this->_resultSetMapping = $this->_parserResult->getResultSetMapping();
     }
     return $executor->execute($this->_em->getConnection(), $sqlParams, $types);
 }
开发者ID:krishcdbry,项目名称:z-zangura,代码行数:50,代码来源:Query.php

示例4: _doExecute

 /**
  * {@inheritdoc}
  */
 protected function _doExecute()
 {
     $executor = $this->_parse()->getSqlExecutor();
     if ($this->_queryCacheProfile) {
         $executor->setQueryCacheProfile($this->_queryCacheProfile);
     }
     if ($this->_resultSetMapping === null) {
         $this->_resultSetMapping = $this->_parserResult->getResultSetMapping();
     }
     // Prepare parameters
     $paramMappings = $this->_parserResult->getParameterMappings();
     if (count($paramMappings) != count($this->parameters)) {
         throw QueryException::invalidParameterNumber();
     }
     // evict all cache for the entity region
     if ($this->hasCache && isset($this->_hints[self::HINT_CACHE_EVICT]) && $this->_hints[self::HINT_CACHE_EVICT]) {
         $this->evictEntityCacheRegion();
     }
     list($sqlParams, $types) = $this->processParameterMappings($paramMappings);
     return $executor->execute($this->_em->getConnection(), $sqlParams, $types);
 }
开发者ID:josercl,项目名称:forum,代码行数:24,代码来源:Query.php

示例5: _prepareParams

 /**
  * {@inheritdoc}
  *
  * @override
  */
 protected function _prepareParams(array $params)
 {
     $sqlParams = array();
     $paramMappings = $this->_parserResult->getParameterMappings();
     if (count($paramMappings) != count($params)) {
         throw QueryException::invalidParameterNumber();
     }
     foreach ($params as $key => $value) {
         if (!isset($paramMappings[$key])) {
             throw QueryException::unknownParameter($key);
         }
         if (is_object($value)) {
             //$values = $this->_em->getClassMetadata(get_class($value))->getIdentifierValues($value);
             $values = $this->_em->getUnitOfWork()->getEntityIdentifier($value);
             //var_dump($this->_em->getUnitOfWork()->getEntityIdentifier($value));
             $sqlPositions = $paramMappings[$key];
             $sqlParams = array_merge($sqlParams, array_combine((array) $sqlPositions, $values));
         } else {
             if (is_bool($value)) {
                 $boolValue = $this->_em->getConnection()->getDatabasePlatform()->convertBooleans($value);
                 foreach ($paramMappings[$key] as $position) {
                     $sqlParams[$position] = $boolValue;
                 }
             } else {
                 foreach ($paramMappings[$key] as $position) {
                     $sqlParams[$position] = $value;
                 }
             }
         }
     }
     ksort($sqlParams);
     return array_values($sqlParams);
 }
开发者ID:andreia,项目名称:doctrine,代码行数:38,代码来源:Query.php


注:本文中的Doctrine\ORM\Query\QueryException::invalidParameterNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。