Skip to content

Commit

Permalink
Remove quoting methods from ClassMetadata (doctrine#9500)
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus authored Feb 11, 2022
1 parent a74807a commit 954439a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 92 deletions.
10 changes: 10 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Upgrade to 3.0

## BC BREAK: Remove quoting methods from `ClassMetadata`

The following methods have been removed from the class metadata because
quoting is handled by implementations of `Doctrine\ORM\Mapping\QuoteStrategy`:

* `getQuotedIdentifierColumnNames()`
* `getQuotedColumnName()`
* `getQuotedTableName()`
* `getQuotedJoinTableName()`

## BC BREAK: Remove ability to merge detached entities

Merge semantics was a poor fit for the PHP "share-nothing" architecture.
Expand Down
90 changes: 0 additions & 90 deletions lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -3253,96 +3253,6 @@ public function getName()
return $this->name;
}

/**
* Gets the (possibly quoted) identifier column names for safe use in an SQL statement.
*
* @deprecated Deprecated since version 2.3 in favor of \Doctrine\ORM\Mapping\QuoteStrategy
*
* @param AbstractPlatform $platform
*
* @return string[]
* @psalm-return list<string>
*/
public function getQuotedIdentifierColumnNames($platform)
{
$quotedColumnNames = [];

foreach ($this->identifier as $idProperty) {
if (isset($this->fieldMappings[$idProperty])) {
$quotedColumnNames[] = isset($this->fieldMappings[$idProperty]['quoted'])
? $platform->quoteIdentifier($this->fieldMappings[$idProperty]['columnName'])
: $this->fieldMappings[$idProperty]['columnName'];

continue;
}

// Association defined as Id field
$joinColumns = $this->associationMappings[$idProperty]['joinColumns'];
$assocQuotedColumnNames = array_map(
static function ($joinColumn) use ($platform) {
return isset($joinColumn['quoted'])
? $platform->quoteIdentifier($joinColumn['name'])
: $joinColumn['name'];
},
$joinColumns
);

$quotedColumnNames = array_merge($quotedColumnNames, $assocQuotedColumnNames);
}

return $quotedColumnNames;
}

/**
* Gets the (possibly quoted) column name of a mapped field for safe use in an SQL statement.
*
* @deprecated Deprecated since version 2.3 in favor of \Doctrine\ORM\Mapping\QuoteStrategy
*
* @param string $field
* @param AbstractPlatform $platform
*
* @return string
*/
public function getQuotedColumnName($field, $platform)
{
return isset($this->fieldMappings[$field]['quoted'])
? $platform->quoteIdentifier($this->fieldMappings[$field]['columnName'])
: $this->fieldMappings[$field]['columnName'];
}

/**
* Gets the (possibly quoted) primary table name of this class for safe use in an SQL statement.
*
* @deprecated Deprecated since version 2.3 in favor of \Doctrine\ORM\Mapping\QuoteStrategy
*
* @param AbstractPlatform $platform
*
* @return string
*/
public function getQuotedTableName($platform)
{
return isset($this->table['quoted'])
? $platform->quoteIdentifier($this->table['name'])
: $this->table['name'];
}

/**
* Gets the (possibly quoted) name of the join table.
*
* @deprecated Deprecated since version 2.3 in favor of \Doctrine\ORM\Mapping\QuoteStrategy
*
* @param mixed[] $assoc
* @param AbstractPlatform $platform
*
* @return string
*/
public function getQuotedJoinTableName(array $assoc, $platform)
{
return isset($assoc['joinTable']['quoted'])
? $platform->quoteIdentifier($assoc['joinTable']['name'])
: $assoc['joinTable']['name'];
}

/**
* {@inheritDoc}
*/
Expand Down
3 changes: 1 addition & 2 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,7 @@
<code>$className</code>
<code>$this-&gt;namespace . '\\' . $className</code>
</LessSpecificReturnStatement>
<MissingClosureParamType occurrences="2">
<code>$joinColumn</code>
<MissingClosureParamType occurrences="1">
<code>$joinColumn</code>
</MissingClosureParamType>
<MissingClosureReturnType occurrences="1">
Expand Down

0 comments on commit 954439a

Please sign in to comment.