Skip to content

Commit 96f5f84

Browse files
authored
Merge pull request #10741 from greg0ire/cleanup-bc-layers
Cleanup bc layers
2 parents 46ff264 + 0945f60 commit 96f5f84

File tree

6 files changed

+13
-128
lines changed

6 files changed

+13
-128
lines changed

lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/UpdateCommand.php

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected function configure(): void
2929
$this->setName($this->name)
3030
->setDescription('Executes (or dumps) the SQL needed to update the database schema to match the current mapping metadata')
3131
->addOption('em', null, InputOption::VALUE_REQUIRED, 'Name of the entity manager to operate on')
32-
->addOption('complete', null, InputOption::VALUE_NONE, 'If defined, all assets of the database which are not relevant to the current metadata will be dropped.')
32+
->addOption('complete', null, InputOption::VALUE_NONE, 'This option is a no-op and will be removed in 4.0')
3333
->addOption('dump-sql', null, InputOption::VALUE_NONE, 'Dumps the generated SQL statements to the screen (does not execute them).')
3434
->addOption('force', 'f', InputOption::VALUE_NONE, 'Causes the generated SQL statements to be physically executed against your database.')
3535
->setHelp(<<<'EOT'
@@ -50,11 +50,10 @@ protected function configure(): void
5050
5151
<info>%command.name% --dump-sql --force</info>
5252
53-
Finally, be aware that if the <info>--complete</info> option is passed, this
54-
task will drop all database assets (e.g. tables, etc) that are *not* described
55-
by the current metadata. In other words, without this option, this task leaves
56-
untouched any "extra" tables that exist in the database, but which aren't
57-
described by any metadata. Not passing that option is deprecated.
53+
Finally, be aware that this task will drop all database assets (e.g. tables,
54+
etc) that are *not* described by the current metadata. In other words, without
55+
this option, this task leaves untouched any "extra" tables that exist in the
56+
database, but which aren't described by any metadata.
5857
5958
<comment>Hint:</comment> If you have a database with tables that should not be managed
6059
by the ORM, you can use a DBAL functionality to filter the tables and sequences down
@@ -71,17 +70,7 @@ protected function executeSchemaCommand(InputInterface $input, OutputInterface $
7170
{
7271
$notificationUi = $ui->getErrorStyle();
7372

74-
// Defining if update is complete or not (--complete not defined means $saveMode = true)
75-
$saveMode = ! $input->getOption('complete');
76-
77-
if ($saveMode) {
78-
$notificationUi->warning(sprintf(
79-
'Not passing the "--complete" option to "%s" is deprecated and will not be supported when using doctrine/dbal 4',
80-
$this->getName() ?? $this->name,
81-
));
82-
}
83-
84-
$sqls = $schemaTool->getUpdateSchemaSql($metadatas, $saveMode);
73+
$sqls = $schemaTool->getUpdateSchemaSql($metadatas);
8574

8675
if (empty($sqls)) {
8776
$notificationUi->success('Nothing to update - your database is already in sync with the current entity metadata.');
@@ -106,7 +95,7 @@ protected function executeSchemaCommand(InputInterface $input, OutputInterface $
10695
$notificationUi->text('Updating database schema...');
10796
$notificationUi->newLine();
10897

109-
$schemaTool->updateSchema($metadatas, $saveMode);
98+
$schemaTool->updateSchema($metadatas);
11099

111100
$pluralization = count($sqls) === 1 ? 'query was' : 'queries were';
112101

lib/Doctrine/ORM/Tools/SchemaTool.php

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Doctrine\DBAL\Schema\Schema;
1313
use Doctrine\DBAL\Schema\Table;
1414
use Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets;
15-
use Doctrine\Deprecations\Deprecation;
1615
use Doctrine\ORM\EntityManagerInterface;
1716
use Doctrine\ORM\Mapping\AssociationMapping;
1817
use Doctrine\ORM\Mapping\ClassMetadata;
@@ -37,7 +36,6 @@
3736
use function class_exists;
3837
use function count;
3938
use function current;
40-
use function func_num_args;
4139
use function implode;
4240
use function in_array;
4341
use function is_numeric;
@@ -885,24 +883,12 @@ public function getDropSchemaSQL(array $classes): array
885883
* instances to the current database schema that is inspected.
886884
*
887885
* @param mixed[] $classes
888-
* @param bool $saveMode If TRUE, only performs a partial update
889-
* without dropping assets which are scheduled for deletion.
890886
*/
891-
public function updateSchema(array $classes, bool $saveMode = false): void
887+
public function updateSchema(array $classes): void
892888
{
893-
if (func_num_args() > 1) {
894-
Deprecation::triggerIfCalledFromOutside(
895-
'doctrine/orm',
896-
'https://github.com/doctrine/orm/pull/10153',
897-
'Passing $saveMode to %s() is deprecated and will not be possible in Doctrine ORM 3.0.',
898-
__METHOD__,
899-
);
900-
}
889+
$conn = $this->em->getConnection();
901890

902-
$updateSchemaSql = $this->getUpdateSchemaSql($classes, $saveMode);
903-
$conn = $this->em->getConnection();
904-
905-
foreach ($updateSchemaSql as $sql) {
891+
foreach ($this->getUpdateSchemaSql($classes) as $sql) {
906892
$conn->executeStatement($sql);
907893
}
908894
}
@@ -911,32 +897,17 @@ public function updateSchema(array $classes, bool $saveMode = false): void
911897
* Gets the sequence of SQL statements that need to be performed in order
912898
* to bring the given class mappings in-synch with the relational schema.
913899
*
914-
* @param bool $saveMode If TRUE, only generates SQL for a partial update
915-
* that does not include SQL for dropping assets which are scheduled for deletion.
916-
* @param list<ClassMetadata> $classes The classes to consider.
900+
* @param list<ClassMetadata> $classes The classes to consider.
917901
*
918902
* @return list<string> The sequence of SQL statements.
919903
*/
920-
public function getUpdateSchemaSql(array $classes, bool $saveMode = false): array
904+
public function getUpdateSchemaSql(array $classes): array
921905
{
922-
if (func_num_args() > 1) {
923-
Deprecation::triggerIfCalledFromOutside(
924-
'doctrine/orm',
925-
'https://github.com/doctrine/orm/pull/10153',
926-
'Passing $saveMode to %s() is deprecated and will not be possible in Doctrine ORM 3.0.',
927-
__METHOD__,
928-
);
929-
}
930-
931906
$toSchema = $this->getSchemaFromMetadata($classes);
932907
$fromSchema = $this->createSchemaForComparison($toSchema);
933908
$comparator = $this->schemaManager->createComparator();
934909
$schemaDiff = $comparator->compareSchemas($fromSchema, $toSchema);
935910

936-
if ($saveMode) {
937-
return $schemaDiff->toSaveSql($this->platform);
938-
}
939-
940911
return $this->platform->getAlterSchemaSQL($schemaDiff);
941912
}
942913

lib/Doctrine/ORM/Tools/SchemaValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,6 @@ public function getUpdateSchemaList(): array
278278

279279
$allMetadata = $this->em->getMetadataFactory()->getAllMetadata();
280280

281-
return $schemaTool->getUpdateSchemaSql($allMetadata, true);
281+
return $schemaTool->getUpdateSchemaSql($allMetadata);
282282
}
283283
}

phpstan-dbal4.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,3 @@ parameters:
2222
-
2323
message: '~Strict comparison using \=\=\= between callable\(\)\: mixed and null will always evaluate to false\.~'
2424
path: lib/Doctrine/ORM/Tools/SchemaTool.php
25-
26-
# FIXME
27-
-
28-
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Schema\\\\SchemaDiff\\:\\:toSaveSql\\(\\)\\.$#"
29-
count: 1
30-
path: lib/Doctrine/ORM/Tools/SchemaTool.php

psalm.xml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
<referencedClass name="Doctrine\DBAL\Tools\Console\Command\ReservedWordsCommand" />
2929
<!-- Remove on 3.0.x -->
3030
<referencedClass name="Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets"/>
31-
<!-- https://github.com/vimeo/psalm/issues/8617 -->
32-
<referencedClass name="Doctrine\ORM\Mapping\Annotation"/>
3331
</errorLevel>
3432
</DeprecatedClass>
3533
<DeprecatedMethod>
@@ -38,15 +36,8 @@
3836
<!-- Compatibility with DBAL 3 -->
3937
<referencedMethod name="Doctrine\DBAL\Connection::getEventManager"/>
4038
<referencedMethod name="Doctrine\DBAL\Schema\Schema::visit"/>
41-
<!-- Remove on 3.0.x -->
42-
<referencedMethod name="Doctrine\DBAL\Schema\SchemaDiff::toSaveSql"/>
4339
</errorLevel>
4440
</DeprecatedMethod>
45-
<DeprecatedProperty>
46-
<errorLevel type="suppress">
47-
<referencedProperty name="Doctrine\ORM\Mapping\Driver\AttributeDriver::$entityAnnotationClasses"/>
48-
</errorLevel>
49-
</DeprecatedProperty>
5041
<DocblockTypeContradiction>
5142
<errorLevel type="suppress">
5243
<!-- We're catching invalid input here. -->

tests/Doctrine/Tests/ORM/Tools/Console/Command/SchemaTool/UpdateCommandTest.php

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)