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


PHP AbstractPlatform::getSQLResultCasing方法代码示例

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


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

示例1: _getSelectColumnSQL

 /**
  * Gets the SQL snippet of a qualified column name for the given field name.
  *
  * @param string $field The field name.
  * @param ClassMetadata $class The class that declares this field. The table this class is
  *                             mapped to must own the column for the given field.
  * @param string $alias
  */
 protected function _getSelectColumnSQL($field, ClassMetadata $class, $alias = 'r')
 {
     $columnName = $class->columnNames[$field];
     $sql = $this->_getSQLTableAlias($class->name, $alias == 'r' ? '' : $alias) . '.' . $class->getQuotedColumnName($field, $this->_platform);
     $columnAlias = $this->_platform->getSQLResultCasing($columnName . $this->_sqlAliasCounter++);
     $this->_rsm->addFieldResult($alias, $columnAlias, $field);
     return "{$sql} AS {$columnAlias}";
 }
开发者ID:manish436,项目名称:zform,代码行数:16,代码来源:BasicEntityPersister.php

示例2: getEntityHistory

 public function getEntityHistory($className, $id)
 {
     if (!$this->metadataFactory->isAudited($className)) {
         throw new NotAuditedException($className);
     }
     /** @var ClassMetadataInfo|ClassMetadata $class */
     $class = $this->em->getClassMetadata($className);
     $tableName = $this->config->getTableName($class);
     if (!is_array($id)) {
         $id = array($class->identifier[0] => $id);
     }
     $whereId = array();
     foreach ($class->identifier as $idField) {
         if (isset($class->fieldMappings[$idField])) {
             $columnName = $class->fieldMappings[$idField]['columnName'];
         } else {
             if (isset($class->associationMappings[$idField])) {
                 $columnName = $class->associationMappings[$idField]['joinColumns'][0];
             } else {
                 continue;
             }
         }
         $whereId[] = "{$columnName} = ?";
     }
     $whereSQL = implode(' AND ', $whereId);
     $columnList = array($this->config->getRevisionFieldName());
     $columnMap = array();
     foreach ($class->fieldNames as $columnName => $field) {
         $type = Type::getType($class->fieldMappings[$field]['type']);
         $columnList[] = $type->convertToPHPValueSQL($this->quoteStrategy->getColumnName($field, $class, $this->platform), $this->platform) . ' AS ' . $this->platform->quoteSingleIdentifier($field);
         $columnMap[$field] = $this->platform->getSQLResultCasing($columnName);
     }
     foreach ($class->associationMappings as $assoc) {
         if (($assoc['type'] & ClassMetadata::TO_ONE) == 0 || !$assoc['isOwningSide']) {
             continue;
         }
         foreach ($assoc['targetToSourceKeyColumns'] as $sourceCol) {
             $columnList[] = $sourceCol;
             $columnMap[$sourceCol] = $this->platform->getSQLResultCasing($sourceCol);
         }
     }
     $values = array_values($id);
     $query = "SELECT " . implode(', ', $columnList) . " FROM " . $tableName . " e WHERE " . $whereSQL . " ORDER BY e.rev DESC";
     $stmt = $this->em->getConnection()->executeQuery($query, $values);
     $result = array();
     while ($row = $stmt->fetch(Query::HYDRATE_ARRAY)) {
         $rev = $row[$this->config->getRevisionFieldName()];
         unset($row[$this->config->getRevisionFieldName()]);
         $result[] = $this->createEntity($class->name, $columnMap, $row, $rev);
     }
     return $result;
 }
开发者ID:Soullivaneuh,项目名称:EntityAudit,代码行数:52,代码来源:AuditReader.php

示例3: getColumnAlias

 public function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ClassMetadata $class = null)
 {
     // 1 ) Concatenate column name and counter
     // 2 ) Trim the column alias to the maximum identifier length of the platform.
     //     If the alias is to long, characters are cut off from the beginning.
     // 3 ) Strip non alphanumeric characters
     // 4 ) Prefix with "_" if the result its numeric
     $columnName = $columnName . '_' . $counter;
     $columnName = substr($columnName, -$platform->getMaxIdentifierLength());
     $columnName = preg_replace('/[^A-Za-z0-9_]/', '', $columnName);
     $columnName = is_numeric($columnName) ? '_' . $columnName : $columnName;
     return $platform->getSQLResultCasing($columnName);
 }
开发者ID:luxifer,项目名称:doctrine-functions,代码行数:13,代码来源:QuotingStrategy.php

示例4: addAssociationsFromClass

 protected function addAssociationsFromClass(Doctrine\ORM\Mapping\ClassMetadata $class, $alias, $columnAliasMap)
 {
     foreach ($class->associationMappings as $fieldName => $associationMapping) {
         if ($class->isInheritedAssociation($fieldName)) {
             continue;
         }
         if (!$associationMapping['isOwningSide'] || !$associationMapping['type'] & ClassMetadata::TO_ONE) {
             continue;
         }
         if (empty($associationMapping['joinColumns'])) {
             // todo: joinTableColumns
             continue;
         }
         foreach ($associationMapping['joinColumns'] as $joinColumn) {
             $columnName = $joinColumn['name'];
             $columnAlias = $this->platform->getSQLResultCasing($columnAliasMap[$columnName]);
             if (isset($this->metaMappings[$columnAlias])) {
                 throw new \InvalidArgumentException("The column '{$columnAlias}' conflicts with another column in the mapper.");
             }
             $this->addMetaResult($alias, $columnAlias, $columnName, isset($associationMapping['id']) && $associationMapping['id'] === true);
         }
     }
 }
开发者ID:Richmond77,项目名称:learning-nette,代码行数:23,代码来源:ResultSetMappingBuilder.php

示例5: getColumnAlias

 /**
  * {@inheritdoc}
  */
 public function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ClassMetadata $class = null)
 {
     return $platform->getSQLResultCasing($columnName . $counter);
 }
开发者ID:neteasy-work,项目名称:hkgbf_crm,代码行数:7,代码来源:AnsiQuoteStrategy.php

示例6: getColumnAlias

 /**
  * {@inheritdoc}
  */
 public function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ClassMetadata $class = null)
 {
     // Trim the column alias to the maximum identifier length of the platform.
     // If the alias is to long, characters are cut off from the beginning.
     // And strip non alphanumeric characters
     $columnName = $columnName . $counter;
     $columnName = substr($columnName, -$platform->getMaxIdentifierLength());
     $columnName = preg_replace('/[^A-Za-z0-9_]/', '', $columnName);
     return $platform->getSQLResultCasing($columnName);
 }
开发者ID:laiello,项目名称:masfletes,代码行数:13,代码来源:DefaultQuoteStrategy.php

示例7: getSQLColumnAlias

 /**
  * Gets an SQL column alias for a column name.
  *
  * @param string $columnName
  * @return string
  */
 public function getSQLColumnAlias($columnName)
 {
     // Trim the column alias to the maximum identifier length of the platform.
     // If the alias is to long, characters are cut off from the beginning.
     return $this->_platform->getSQLResultCasing(substr($columnName . $this->_sqlAliasCounter++, -$this->_platform->getMaxIdentifierLength()));
 }
开发者ID:pabloasc,项目名称:test_social,代码行数:12,代码来源:BasicEntityPersister.php


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