本文整理汇总了PHP中Doctrine\DBAL\Platforms\AbstractPlatform::quoteIdentifier方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractPlatform::quoteIdentifier方法的具体用法?PHP AbstractPlatform::quoteIdentifier怎么用?PHP AbstractPlatform::quoteIdentifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Platforms\AbstractPlatform
的用法示例。
在下文中一共展示了AbstractPlatform::quoteIdentifier方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAlterTableChangeQuotedColumn
/**
* @group DBAL-585
*/
public function testAlterTableChangeQuotedColumn()
{
$tableDiff = new \Doctrine\DBAL\Schema\TableDiff('mytable');
$tableDiff->fromTable = new \Doctrine\DBAL\Schema\Table('mytable');
$tableDiff->changedColumns['foo'] = new \Doctrine\DBAL\Schema\ColumnDiff('select', new \Doctrine\DBAL\Schema\Column('select', \Doctrine\DBAL\Types\Type::getType('string')), array('type'));
$this->assertContains($this->_platform->quoteIdentifier('select'), implode(';', $this->_platform->getAlterTableSQL($tableDiff)));
}
示例2: getDiscriminatorColumn
private function getDiscriminatorColumn(ClassMetadata $meta)
{
if (!$meta->isInheritanceTypeSingleTable()) {
return [];
}
$column = $meta->discriminatorColumn;
return [$column['fieldName'] => ['value' => $meta->discriminatorValue, 'quotedColumn' => $this->platform->quoteIdentifier($column['name']), 'type' => Type::getType($column['type'])]];
}
示例3: loadIndex
/**
* @param \Doctrine\DBAL\Schema\Table $table
* @param \SimpleXMLElement $xml
* @throws \DomainException
*/
private function loadIndex($table, $xml)
{
$name = null;
$fields = array();
foreach ($xml->children() as $child) {
/**
* @var \SimpleXMLElement $child
*/
switch ($child->getName()) {
case 'name':
$name = (string) $child;
break;
case 'primary':
$primary = $this->asBool($child);
break;
case 'unique':
$unique = $this->asBool($child);
break;
case 'field':
foreach ($child->children() as $field) {
/**
* @var \SimpleXMLElement $field
*/
switch ($field->getName()) {
case 'name':
$field_name = (string) $field;
$field_name = $this->platform->quoteIdentifier($field_name);
$fields[] = $field_name;
break;
case 'sorting':
break;
default:
throw new \DomainException('Unknown element: ' . $field->getName());
}
}
break;
default:
throw new \DomainException('Unknown element: ' . $child->getName());
}
}
if (!empty($fields)) {
if (isset($primary) && $primary) {
if ($table->hasPrimaryKey()) {
return;
}
$table->setPrimaryKey($fields, $name);
} else {
if (isset($unique) && $unique) {
$table->addUniqueIndex($fields, $name);
} else {
$table->addIndex($fields, $name);
}
}
} else {
throw new \DomainException('Empty index definition: ' . $name . ' options:' . print_r($fields, true));
}
}
示例4: getJoinTableName
/**
* {@inheritdoc}
*/
public function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform)
{
$schema = '';
if (isset($association['joinTable']['schema'])) {
$schema = $association['joinTable']['schema'] . '.';
}
$tableName = $association['joinTable']['name'];
if (isset($association['joinTable']['quoted'])) {
$tableName = $platform->quoteIdentifier($tableName);
}
return $schema . $tableName;
}
示例5: quoteIdentifier
/**
* Quotes a string so it can be safely used as a table or column name, even if
* it is a reserved name.
*
* Delimiting style depends on the underlying database platform that is being used.
*
* NOTE: Just because you CAN use quoted identifiers does not mean
* you SHOULD use them. In general, they end up causing way more
* problems than they solve.
*
* @param string $str The name to be quoted.
*
* @return string The quoted name.
*/
public function quoteIdentifier($str)
{
return $this->_platform->quoteIdentifier($str);
}
示例6: getJoinTableName
/**
* {@inheritdoc}
*/
public function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform)
{
return isset($association['joinTable']['quoted']) ? $platform->quoteIdentifier($association['joinTable']['name']) : $association['joinTable']['name'];
}
示例7: getQuotedJoinTableName
/**
* Gets the (possibly quoted) name of the join table.
*
* @deprecated Deprecated since version 2.3 in favor of \Doctrine\ORM\Mapping\QuoteStrategy
*
* @param array $assoc
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
* @return string
*/
public function getQuotedJoinTableName(array $assoc, $platform)
{
return isset($assoc['joinTable']['quoted']) ? $platform->quoteIdentifier($assoc['joinTable']['name']) : $assoc['joinTable']['name'];
}
示例8: 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);
}
示例9: 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)
{
return $this->_quoted ? $platform->quoteIdentifier($this->_name) : $this->_name;
}
示例10: createForeignKeyReplacement
/**
* Creates a foreign index replacement, which has quoted column names.
*
* @param ForeignKeyConstraint $fk
*
* @return ForeignKeyConstraint
*/
private function createForeignKeyReplacement(ForeignKeyConstraint $fk)
{
return new ForeignKeyConstraint($this->quoteIdentifiers($fk->getLocalColumns()), $this->platform->quoteIdentifier($fk->getForeignTableName()), $this->quoteIdentifiers($fk->getForeignColumns()), $this->platform->quoteIdentifier($fk->getName()), $fk->getOptions());
}