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


PHP ResultSetMapping::addIndexByScalar方法代码示例

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


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

示例1: walkFromClause

 /**
  * Walks down a FromClause AST node, thereby generating the appropriate SQL.
  *
  * @return string The SQL.
  */
 public function walkFromClause($fromClause)
 {
     $identificationVarDecls = $fromClause->identificationVariableDeclarations;
     $sqlParts = array();
     foreach ($identificationVarDecls as $identificationVariableDecl) {
         $sql = '';
         $rangeDecl = $identificationVariableDecl->rangeVariableDeclaration;
         $dqlAlias = $rangeDecl->aliasIdentificationVariable;
         $this->_rootAliases[] = $dqlAlias;
         $class = $this->_em->getClassMetadata($rangeDecl->abstractSchemaName);
         $sql .= $class->getQuotedTableName($this->_platform) . ' ' . $this->getSQLTableAlias($class->getTableName(), $dqlAlias);
         if ($class->isInheritanceTypeJoined()) {
             $sql .= $this->_generateClassTableInheritanceJoins($class, $dqlAlias);
         }
         foreach ($identificationVariableDecl->joinVariableDeclarations as $joinVarDecl) {
             $sql .= $this->walkJoinVariableDeclaration($joinVarDecl);
         }
         if ($identificationVariableDecl->indexBy) {
             $alias = $identificationVariableDecl->indexBy->simpleStateFieldPathExpression->identificationVariable;
             $field = $identificationVariableDecl->indexBy->simpleStateFieldPathExpression->field;
             if (isset($this->_scalarFields[$alias][$field])) {
                 $this->_rsm->addIndexByScalar($this->_scalarFields[$alias][$field]);
             } else {
                 $this->_rsm->addIndexBy($identificationVariableDecl->indexBy->simpleStateFieldPathExpression->identificationVariable, $identificationVariableDecl->indexBy->simpleStateFieldPathExpression->field);
             }
         }
         $sqlParts[] = $this->_platform->appendLockHint($sql, $this->_query->getHint(Query::HINT_LOCK_MODE));
     }
     return ' FROM ' . implode(', ', $sqlParts);
 }
开发者ID:williamamed,项目名称:Raptor2,代码行数:35,代码来源:SqlWalker.php

示例2: walkFromClause

    /**
     * {@inheritdoc}
     */
    public function walkFromClause($fromClause)
    {
        $identificationVarDecls = $fromClause->identificationVariableDeclarations;
        $sqlParts = array();

        foreach ($identificationVarDecls as $identificationVariableDecl) {
            $sql = $this->platform->appendLockHint(
                $this->walkRangeVariableDeclaration($identificationVariableDecl->rangeVariableDeclaration),
                $this->query->getHint(Query::HINT_LOCK_MODE)
            );

            foreach ($identificationVariableDecl->joins as $join) {
                $sql .= $this->walkJoin($join);
            }

            if ($identificationVariableDecl->indexBy) {
                $alias = $identificationVariableDecl->indexBy->simpleStateFieldPathExpression->identificationVariable;
                $field = $identificationVariableDecl->indexBy->simpleStateFieldPathExpression->field;

                if (isset($this->scalarFields[$alias][$field])) {
                    $this->rsm->addIndexByScalar($this->scalarFields[$alias][$field]);
                } else {
                    $this->rsm->addIndexBy(
                        $identificationVariableDecl->indexBy->simpleStateFieldPathExpression->identificationVariable,
                        $identificationVariableDecl->indexBy->simpleStateFieldPathExpression->field
                    );
                }
            }

            $sqlParts[] = $sql;
        }

        return ' FROM ' . implode(', ', $sqlParts);
    }
开发者ID:nattaphat,项目名称:hgis,代码行数:37,代码来源:SqlWalker.php

示例3: walkIndexBy

 /**
  * Walks down a IndexBy AST node.
  *
  * @param AST\IndexBy $indexBy
  *
  * @return void
  */
 public function walkIndexBy($indexBy)
 {
     $pathExpression = $indexBy->simpleStateFieldPathExpression;
     $alias = $pathExpression->identificationVariable;
     $field = $pathExpression->field;
     if (isset($this->scalarFields[$alias][$field])) {
         $this->rsm->addIndexByScalar($this->scalarFields[$alias][$field]);
         return;
     }
     $this->rsm->addIndexBy($alias, $field);
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:18,代码来源:SqlWalker.php

示例4: testIndexByScalarsOnly

 /**
  * SELECT UPPER(u.name) AS nameUpper
  *   FROM Doctrine\Tests\Models\CMS\CmsUser u
  *
  * @group DDC-1385
  * @dataProvider provideDataForUserEntityResult
  */
 public function testIndexByScalarsOnly($userEntityKey)
 {
     $rsm = new ResultSetMapping();
     $rsm->addEntityResult('Doctrine\\Tests\\Models\\CMS\\CmsUser', 'u', $userEntityKey ?: null);
     $rsm->addScalarResult('sclr0', 'nameUpper');
     $rsm->addIndexByScalar('sclr0');
     // Faked result set
     $resultSet = array(array('sclr0' => 'ROMANB'), array('sclr0' => 'JWAGE'));
     $stmt = new HydratorMockStatement($resultSet);
     $hydrator = new \Doctrine\ORM\Internal\Hydration\ObjectHydrator($this->_em);
     $result = $hydrator->hydrateAll($stmt, $rsm, array(Query::HINT_FORCE_PARTIAL_LOAD => true));
     $this->assertEquals(array('ROMANB' => array('nameUpper' => 'ROMANB'), 'JWAGE' => array('nameUpper' => 'JWAGE')), $result);
 }
开发者ID:selimcr,项目名称:servigases,代码行数:20,代码来源:ObjectHydratorTest.php


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