本文整理汇总了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];
}
示例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);
}
示例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'));
}