當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。