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