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


PHP QueryBuilder::getType方法代码示例

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


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

示例1: getSQLDelegatesToConcreteQueryBuilder

 /**
  * @test
  */
 public function getSQLDelegatesToConcreteQueryBuilder()
 {
     $this->concreteQueryBuilder->getSQL()->shouldBeCalled()->willReturn('UPDATE aTable SET pid = 7');
     $this->concreteQueryBuilder->getType()->willReturn(2);
     // Update Type
     $this->subject->getSQL();
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:10,代码来源:QueryBuilderTest.php

示例2: __construct

 /**
  * Constructor.
  *
  * @param QueryBuilder $queryBuilder              A DBAL query builder.
  * @param callable     $countQueryBuilderModifier A callable to modifier the query builder to count.
  */
 public function __construct(QueryBuilder $queryBuilder, $countQueryBuilderModifier)
 {
     if ($queryBuilder->getType() !== QueryBuilder::SELECT) {
         throw new InvalidArgumentException('Only SELECT queries can be paginated.');
     }
     if (!is_callable($countQueryBuilderModifier)) {
         throw new InvalidArgumentException('The count query builder modifier must be a callable.');
     }
     $this->queryBuilder = clone $queryBuilder;
     $this->countQueryBuilderModifier = $countQueryBuilderModifier;
 }
开发者ID:yakamoz-fang,项目名称:concrete,代码行数:17,代码来源:DoctrineDbalAdapter.php

示例3: __construct

 /**
  * Constructor.
  *
  * @param QueryBuilder $queryBuilder A DBAL query builder.
  * @param string $countField Primary key for the table in query. Used in count expression. Must include table alias
  * @param boolean $useDistinct When set to true it'll count the countfield with a distinct in front of it.
  *
  * @api
  */
 public function __construct(QueryBuilder $queryBuilder, $countField, $useDistinct = true)
 {
     if (strpos($countField, '.') === false) {
         throw new LogicException('The $countField must contain a table alias in the string.');
     }
     if (QueryBuilder::SELECT !== $queryBuilder->getType()) {
         throw new LogicException('Only SELECT queries can be paginated.');
     }
     $this->queryBuilder = $queryBuilder;
     $this->countField = $countField;
     $this->useDistinct = $useDistinct;
 }
开发者ID:hyrmedia,项目名称:KunstmaanBundlesCMS,代码行数:21,代码来源:DoctrineDBALAdapter.php

示例4: testEmptyDelete

 public function testEmptyDelete()
 {
     $qb = new QueryBuilder($this->conn);
     $qb2 = $qb->delete();
     $this->assertEquals(QueryBuilder::DELETE, $qb->getType());
     $this->assertSame($qb2, $qb);
 }
开发者ID:robertowest,项目名称:CuteFlow-V4,代码行数:7,代码来源:QueryBuilderTest.php

示例5: testEmptyInsert

 public function testEmptyInsert()
 {
     $qb = new QueryBuilder($this->conn);
     $qb2 = $qb->insert();
     $this->assertEquals(QueryBuilder::INSERT, $qb->getType());
     $this->assertSame($qb2, $qb);
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:7,代码来源:QueryBuilderTest.php

示例6: getType

 /**
  * Gets the type of the currently built query.
  *
  * @return integer
  */
 public function getType()
 {
     return $this->queryBuilder->getType();
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:9,代码来源:QueryBuilder.php

示例7: getType

 /**
  * Gets the type of the currently built query.
  *
  * @return integer
  */
 public function getType()
 {
     return $this->qb->getType();
 }
开发者ID:Maksold,项目名称:platform,代码行数:9,代码来源:SqlQueryBuilder.php

示例8: getCount

 /**
  * Counts the number of results that would be returned by the select query provided
  *
  * @param QueryBuilder $qb
  * @return int
  */
 public function getCount(QueryBuilder $qb)
 {
     if ($qb->getType() != QueryBuilder::SELECT) {
         throw new \InvalidArgumentException('Query builder must be a select query');
     }
     $select = $qb->getQueryPart('select');
     $count = (int) $qb->select('COUNT(main.id)')->execute()->fetchColumn();
     $qb->select($select);
     return $count;
 }
开发者ID:thewunder,项目名称:corma,代码行数:16,代码来源:QueryHelper.php

示例9: generator

 /**
  * Generator for SELECT queries.
  *
  * @param \Doctrine\DBAL\Query\QueryBuilder $qb
  *
  * @return \Iterator
  */
 protected function generator(QueryBuilder $qb)
 {
     if ($qb->getType() !== QueryBuilder::SELECT) {
         self::raise('Generator should be used only with SELECT queries.');
     }
     $stmt = $this->preprocess($qb);
     while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
         $from = $join = [];
         foreach ($row as $key => $value) {
             // if column was preprocessed
             if (false !== ($pos = strpos($key, self::UNIQUE))) {
                 $table = substr($key, 0, $pos);
                 $column = substr($key, $pos + 6);
                 if ($table === $this->table) {
                     $from[$column] = $value;
                 } else {
                     $join[$table][$column] = $value;
                 }
             } else {
                 $from[$key] = $value;
             }
         }
         $class = $this->entity;
         $entity = new $class($from);
         foreach ($join as $table => $data) {
             // every JOIN will be set as a sub-entity
             $class = $this->app['arm'][$this->prefix . $table]->getEntity();
             $entity[$table] = new $class($data);
         }
         (yield $entity);
     }
 }
开发者ID:lokhman,项目名称:silex-arm,代码行数:39,代码来源:Repository.php


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