diff --git a/UPGRADE.md b/UPGRADE.md
index 955216026f1..ed30555dbde 100644
--- a/UPGRADE.md
+++ b/UPGRADE.md
@@ -8,6 +8,11 @@ awareness about deprecated code.
# Upgrade to 3.2
+## Deprecated `AbstractAsset::getFullQualifiedName()`.
+
+The `AbstractAsset::getFullQualifiedName()` method has been deprecated. Use `::getNamespaceName()`
+and `::getName()` instead.
+
## Deprecated schema methods related to explicit foreign key indexes.
The following methods have been deprecated:
diff --git a/psalm.xml.dist b/psalm.xml.dist
index 0b178cce843..2cfb15aa1bc 100644
--- a/psalm.xml.dist
+++ b/psalm.xml.dist
@@ -159,6 +159,11 @@
See https://github.com/doctrine/dbal/pull/4822
-->
+
+
diff --git a/src/Schema/AbstractAsset.php b/src/Schema/AbstractAsset.php
index e3b3b3a0164..622500f8f0b 100644
--- a/src/Schema/AbstractAsset.php
+++ b/src/Schema/AbstractAsset.php
@@ -3,6 +3,7 @@
namespace Doctrine\DBAL\Schema;
use Doctrine\DBAL\Platforms\AbstractPlatform;
+use Doctrine\Deprecations\Deprecation;
use function array_map;
use function crc32;
@@ -102,7 +103,7 @@ public function getShortestName($defaultNamespaceName)
}
/**
- * The normalized name is full-qualified and lowerspaced. Lowerspacing is
+ * The normalized name is full-qualified and lower-cased. Lower-casing is
* actually wrong, but we have to do it to keep our sanity. If you are
* using database objects that only differentiate in the casing (FOO vs
* Foo) then you will NOT be able to use Doctrine Schema abstraction.
@@ -110,12 +111,21 @@ public function getShortestName($defaultNamespaceName)
* Every non-namespaced element is prefixed with the default namespace
* name which is passed as argument to this method.
*
+ * @deprecated Use {@link getNamespaceName()} and {@link getName()} instead.
+ *
* @param string $defaultNamespaceName
*
* @return string
*/
public function getFullQualifiedName($defaultNamespaceName)
{
+ Deprecation::triggerIfCalledFromOutside(
+ 'doctrine/dbal',
+ 'https://github.com/doctrine/dbal/pull/4814',
+ 'AbstractAsset::getFullQualifiedName() is deprecated.'
+ . ' Use AbstractAsset::getNamespaceName() and ::getName() instead.'
+ );
+
$name = $this->getName();
if ($this->_namespace === null) {
$name = $defaultNamespaceName . '.' . $name;
diff --git a/src/Schema/Schema.php b/src/Schema/Schema.php
index 90051480ea4..8e4570f2c6f 100644
--- a/src/Schema/Schema.php
+++ b/src/Schema/Schema.php
@@ -112,7 +112,7 @@ public function hasExplicitForeignKeyIndexes()
protected function _addTable(Table $table)
{
$namespaceName = $table->getNamespaceName();
- $tableName = $table->getFullQualifiedName($this->getName());
+ $tableName = $this->normalizeName($table);
if (isset($this->_tables[$tableName])) {
throw SchemaException::tableAlreadyExists($tableName);
@@ -138,7 +138,7 @@ protected function _addTable(Table $table)
protected function _addSequence(Sequence $sequence)
{
$namespaceName = $sequence->getNamespaceName();
- $seqName = $sequence->getFullQualifiedName($this->getName());
+ $seqName = $this->normalizeName($sequence);
if (isset($this->_sequences[$seqName])) {
throw SchemaException::sequenceAlreadyExists($seqName);
@@ -208,6 +208,11 @@ private function getFullQualifiedAssetName($name)
return strtolower($name);
}
+ private function normalizeName(AbstractAsset $asset): string
+ {
+ return $asset->getFullQualifiedName($this->getName());
+ }
+
/**
* Returns the unquoted representation of a given asset name.
*