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