Skip to content

Commit

Permalink
Merge branch '4.3.x' into 5.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Dec 23, 2024
2 parents 0f5440f + 83918a4 commit 98a18fd
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
17 changes: 17 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,23 @@ all drivers and middleware.

# Upgrade to 4.3

## Deprecated `AbstractAsset` namespace-related methods and property

The following namespace-related methods and property have been deprecated:

- `AbstractAsset::getNamespaceName()`
- `AbstractAsset::isInDefaultNamespace()`
- `AbstractAsset::$_namespace`

In order to identify the namespace of an object, use the following methods instead:

```php
$qualifier = $table->getObjectName()->getQualifier();
```

If the return value is not null, then it will contain the identifier representing the namespace name – its value and
whether it's quoted.

## `Table::__construct()` marked as internal

The `Table::__construct()` method has been marked as internal. Use `Table::editor()` to instantiate an editor and
Expand Down
17 changes: 17 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,25 @@
-->
<referencedMethod name="Doctrine\DBAL\Schema\AbstractAsset::getNameParser" />
<referencedMethod name="Doctrine\DBAL\Schema\AbstractAsset::setName" />

<!--
https://github.com/doctrine/dbal/pull/6664
TODO: remove in 5.0.0
-->
<referencedMethod name="Doctrine\DBAL\Schema\AbstractAsset::getNamespaceName" />
<referencedMethod name="Doctrine\DBAL\Schema\AbstractAsset::isInDefaultNamespace" />
</errorLevel>
</DeprecatedMethod>
<DeprecatedProperty>
<errorLevel type="suppress">
<!--
https://github.com/doctrine/dbal/pull/6664
TODO: remove in 5.0.0
-->
<referencedProperty name="Doctrine\DBAL\Schema\AbstractAsset::$_namespace" />
<referencedProperty name="Doctrine\DBAL\Schema\Table::$_namespace" />
</errorLevel>
</DeprecatedProperty>
<DocblockTypeContradiction>
<errorLevel type="suppress">
<!--
Expand Down
22 changes: 22 additions & 0 deletions src/Schema/AbstractAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Doctrine\DBAL\Schema\Name\OptionallyQualifiedName;
use Doctrine\DBAL\Schema\Name\Parser;
use Doctrine\DBAL\Schema\Name\UnqualifiedName;
use Doctrine\Deprecations\Deprecation;

use function array_map;
use function assert;
Expand Down Expand Up @@ -40,6 +41,8 @@ abstract class AbstractAsset

/**
* Namespace of the asset. If none isset the default namespace is assumed.
*
* @deprecated Use {@see NamedObject::getObjectName()} and {@see OptionallyQualifiedName::getQualifier()} instead.
*/
protected ?string $_namespace = null;

Expand Down Expand Up @@ -133,19 +136,38 @@ protected function setName(?Name $name): void

/**
* Is this asset in the default namespace?
*
* @deprecated
*/
public function isInDefaultNamespace(string $defaultNamespaceName): bool
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/6664',
'%s is deprecated and will be removed in 5.0.',
__METHOD__,
);

return $this->_namespace === $defaultNamespaceName || $this->_namespace === null;
}

/**
* Gets the namespace name of this asset.
*
* If NULL is returned this means the default namespace is used.
*
* @deprecated Use {@see NamedObject::getObjectName()} and {@see OptionallyQualifiedName::getQualifier()} instead.
*/
public function getNamespaceName(): ?string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/6664',
'%s is deprecated and will be removed in 5.0. Use NamedObject::getObjectName()'
. ' and OptionallyQualifiedName::getQualifier() instead.',
__METHOD__,
);

return $this->_namespace;
}

Expand Down

0 comments on commit 98a18fd

Please sign in to comment.