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


PHP Query::execute方法代碼示例

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


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

示例1: count

 public function count()
 {
     if ($this->count === null) {
         if ($this->countQuery) {
             try {
                 $res = $this->countQuery->execute();
                 $this->count = $res[0]['c'];
             } catch (NoResultException $e) {
                 $this->count = 0;
             }
         } else {
             $this->count = parent::count();
         }
     }
     return $this->count;
 }
開發者ID:arstropica,項目名稱:zf2-dashboard,代碼行數:16,代碼來源:Paginator.php

示例2: execute

 /**
  * Executes query and saving query SQL to list (if needed)
  *
  * @access   public
  * @param    boolean $noResults returns no results, if TRUE
  * @return   array
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function execute($noResults = FALSE)
 {
     if (!$noResults) {
         static::$mResult = $this->oQuery->getResult();
     } else {
         static::$mResult = $this->oQuery->execute();
     }
     return static::$mResult;
 }
開發者ID:ktrzos,項目名稱:plethora,代碼行數:18,代碼來源:DB.php

示例3: getPostIds

 /**
  * @param DBALQueryBuilder|Query $queryBuilder
  *
  * @return int[]
  */
 private function getPostIds($queryBuilder)
 {
     $ids = [];
     if ($queryBuilder instanceof DBALQueryBuilder) {
         foreach ($queryBuilder->execute()->fetchAll() as $post) {
             $ids[] = (int) $post['id'];
         }
     } elseif ($queryBuilder instanceof Query) {
         foreach ($queryBuilder->getResult() as $post) {
             $ids[] = $post->getId();
         }
     }
     return array_unique($ids);
 }
開發者ID:dragosprotung,項目名稱:AclBundle,代碼行數:19,代碼來源:AclFilterTest.php

示例4: _performQuery

 /**
  * _performQuery() - This method accepts a Doctrine\ORM\Query object and
  * performs a query against the database with that object.
  *
  * @param Doctrine\ORM\Query $query
  * @throws \Zend\Authentication\Adapter\Exception\RuntimeException - when a invalid select object is encoutered
  * @return array
  */
 protected function _performQuery(\Doctrine\ORM\Query $query)
 {
     try {
         $resultIdentities = $query->execute();
     } catch (Exception $e) {
         /**
          * @see \Zend\Authentication\Adapter\Exception\RuntimeException
          */
         require_once 'Zend/Auth/Adapter/Exception.php';
         throw new \Zend\Authentication\Adapter\Exception\RuntimeException('The supplied parameters to \\Doctrine\\ORM\\EntityManager failed to ' . 'produce a valid sql statement, please check entity and column names ' . 'for validity.');
     }
     return $resultIdentities;
 }
開發者ID:ram600,項目名稱:vasabi,代碼行數:21,代碼來源:Doctrine.php

示例5: fetch

 public function fetch(Query $query, $mode = self::FETCH_ALL)
 {
     if ($mode == self::FETCH_ALL) {
         if ($query->getMaxResults() !== null && $query->getHydrationMode() != self::HYDRATE_SINGLE_SCALAR) {
             return (new Paginator($query))->getIterator()->getArrayCopy();
         } else {
             return $query->execute();
         }
     } else {
         if ($mode == self::FETCH_ALL_PAGED) {
             return new Paginator($query);
         } else {
             if ($mode == self::FETCH_ONE) {
                 $query->setMaxResults(1);
                 if ($query->getHydrationMode() != self::HYDRATE_SINGLE_SCALAR) {
                     return (new Paginator($query))->getIterator()->current();
                 } else {
                     return $query->getOneOrNullResult();
                 }
             } else {
                 if ($mode == self::FETCH_ONE_UNIQUE) {
                     return $query->getOneOrNullResult();
                 }
             }
         }
     }
 }
開發者ID:jacksleight,項目名稱:chalk,代碼行數:27,代碼來源:Repository.php


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