Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate schema methods related to explicit foreign key indexes #4822

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ awareness about deprecated code.

# Upgrade to 3.2

## Deprecated schema methods related to explicit foreign key indexes.

The following methods have been deprecated:

- `Schema::hasExplicitForeignKeyIndexes()`,
- `SchemaConfig::hasExplicitForeignKeyIndexes()`,
- `SchemaConfig::setExplicitForeignKeyIndexes()`.

## Deprecated `Schema::getTableNames()`.

The `Schema::getTableNames()` method has been deprecated. In order to obtain schema table names,
Expand Down
10 changes: 10 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@
TODO: remove in 4.0.0
-->
<referencedMethod name="Doctrine\DBAL\Platforms\OraclePlatform::assertValidIdentifier"/>
<!--
TODO: remove in 4.0.0
See https://github.com/doctrine/dbal/pull/4822
-->
<referencedMethod name="Doctrine\DBAL\Schema\SchemaConfig::hasExplicitForeignKeyIndexes"/>
</errorLevel>
</DeprecatedMethod>
<DeprecatedProperty>
Expand All @@ -169,6 +174,11 @@
See https://github.com/doctrine/dbal/pull/4620
-->
<file name="src/Configuration.php"/>
<!--
This suppression should be removed in 4.0.x
See https://github.com/doctrine/dbal/pull/4822
-->
<referencedProperty name="Doctrine\DBAL\Schema\SchemaConfig::$hasExplicitForeignKeyIndexes"/>
</errorLevel>
</DeprecatedProperty>
<DocblockTypeContradiction>
Expand Down
8 changes: 8 additions & 0 deletions src/Schema/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,18 @@ public function __construct(
}

/**
* @deprecated
*
* @return bool
*/
public function hasExplicitForeignKeyIndexes()
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/4822',
'Schema::hasExplicitForeignKeyIndexes() is deprecated.'
);

return $this->_schemaConfig->hasExplicitForeignKeyIndexes();
}

Expand Down
24 changes: 23 additions & 1 deletion src/Schema/SchemaConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

namespace Doctrine\DBAL\Schema;

use Doctrine\Deprecations\Deprecation;

/**
* Configuration for a Schema.
*/
class SchemaConfig
{
/** @var bool */
/**
* @deprecated
*
* @var bool
*/
protected $hasExplicitForeignKeyIndexes = false;

/** @var int */
Expand All @@ -20,20 +26,36 @@ class SchemaConfig
protected $defaultTableOptions = [];

/**
* @deprecated
*
* @return bool
*/
public function hasExplicitForeignKeyIndexes()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/4822',
'SchemaConfig::hasExplicitForeignKeyIndexes() is deprecated.'
);

return $this->hasExplicitForeignKeyIndexes;
}

/**
* @deprecated
*
* @param bool $flag
*
* @return void
*/
public function setExplicitForeignKeyIndexes($flag)
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/4822',
'SchemaConfig::setExplicitForeignKeyIndexes() is deprecated.'
);

$this->hasExplicitForeignKeyIndexes = (bool) $flag;
}

Expand Down