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


PHP AbstractPlatform::getReservedKeywordsList方法代码示例

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


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

示例1: colConfig

 /**
  * @param Column $col
  * @return array
  */
 protected function colConfig(Column $col)
 {
     $conf = [];
     //var_dump($col->toArray()); //, $col->getType()->getTypesMap());
     $fieldClass = self::$dbType2FieldClass[$col->getType()->getName()];
     $fieldName = $col->getName();
     if ($col->getAutoincrement()) {
         $fieldClass = 'Auto';
     } elseif (substr($col->getName(), -3) === '_id') {
         $fieldClass = 'ForeignKey';
         $fk_tbl = substr($col->getName(), 0, strpos($col->getName(), '_id'));
         $fieldName = $fk_tbl;
         $conf['relationClass'] = $this->table2model($fk_tbl);
         $conf['db_column'] = $col->getName();
         if (!isset($this->generated[$fk_tbl])) {
             $this->generateQueue[] = $fk_tbl;
         }
     }
     array_unshift($conf, $fieldClass);
     if ($this->dp->getReservedKeywordsList()->isKeyword($col->getName())) {
         $conf['db_column'] = 'f_' . $col->getName();
     }
     if ($col->getNotnull() === false) {
         $conf['null'] = true;
     }
     if ($col->getLength() !== null) {
         $conf['max_length'] = $col->getLength();
     }
     if ($col->getDefault() !== null) {
         if ($col->getDefault() !== 'CURRENT_TIMESTAMP') {
             $conf['default'] = $col->getType()->convertToPHPValue($col->getDefault(), $this->dp);
             if ($conf['default'] === '') {
                 $conf['blank'] = true;
             }
         }
     }
     if ($col->getComment() !== null) {
         $help = $col->getComment();
         if (strpos($help, PHP_EOL) !== false) {
             $help = str_replace(PHP_EOL, '', $help);
         }
         $conf['help_text'] = $help;
     }
     return [$fieldName, $conf];
 }
开发者ID:buldezir,项目名称:dja_orm,代码行数:49,代码来源:Introspection.php

示例2: getQuotedName

 /**
  * Get the quoted representation of this asset but only if it was defined with one. Otherwise
  * return the plain unquoted value as inserted.
  *
  * @param AbstractPlatform $platform
  * @return string
  */
 public function getQuotedName(AbstractPlatform $platform)
 {
     $keywords = $platform->getReservedKeywordsList();
     $parts = explode(".", $this->getName());
     foreach ($parts as $k => $v) {
         $parts[$k] = $this->_quoted || $keywords->isKeyword($v) ? $platform->quoteIdentifier($v) : $v;
     }
     return implode(".", $parts);
 }
开发者ID:pollux1er,项目名称:dlawebdev2,代码行数:16,代码来源:AbstractAsset.php

示例3: testKeywordList

 /**
  * @group DBAL-45
  */
 public function testKeywordList()
 {
     $keywordList = $this->_platform->getReservedKeywordsList();
     $this->assertInstanceOf('Doctrine\\DBAL\\Platforms\\Keywords\\KeywordList', $keywordList);
     $this->assertTrue($keywordList->isKeyword('table'));
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:9,代码来源:AbstractPlatformTestCase.php


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