Skip to content

Commit

Permalink
Merge pull request #4822 from morozov/deprecate-has-explicit-foreign-…
Browse files Browse the repository at this point in the history
…key-indexes

Deprecate schema methods related to explicit foreign key indexes
  • Loading branch information
morozov authored Sep 28, 2021
2 parents bacdbce + 0374efe commit b631c0b
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
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

0 comments on commit b631c0b

Please sign in to comment.