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