Skip to content

Commit 458c7bf

Browse files
committed
fix: unfreeze dependencies after command
1 parent 1b88fcb commit 458c7bf

14 files changed

+24
-13
lines changed

src/Tools/Console/Command/CurrentCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected function configure(): void
2929
parent::configure();
3030
}
3131

32-
protected function execute(InputInterface $input, OutputInterface $output): int
32+
protected function doExecute(InputInterface $input, OutputInterface $output): int
3333
{
3434
$aliasResolver = $this->getDependencyFactory()->getVersionAliasResolver();
3535

src/Tools/Console/Command/DiffCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ protected function configure(): void
9898
}
9999

100100
/** @throws InvalidOptionUsage */
101-
protected function execute(
101+
protected function doExecute(
102102
InputInterface $input,
103103
OutputInterface $output,
104104
): int {

src/Tools/Console/Command/DoctrineCommand.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,17 @@ protected function initialize(InputInterface $input, OutputInterface $output): v
119119
$dependencyFactory->freeze();
120120
}
121121

122+
protected function execute(InputInterface $input, OutputInterface $output): int
123+
{
124+
try {
125+
return $this->doExecute($input, $output);
126+
} finally {
127+
$this->dependencyFactory?->unfreeze();
128+
}
129+
}
130+
131+
abstract protected function doExecute(InputInterface $input, OutputInterface $output): int;
132+
122133
protected function getDependencyFactory(): DependencyFactory
123134
{
124135
if ($this->dependencyFactory === null) {

src/Tools/Console/Command/DumpSchemaCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected function configure(): void
8080
}
8181

8282
/** @throws SchemaDumpRequiresNoMigrations */
83-
public function execute(
83+
public function doExecute(
8484
InputInterface $input,
8585
OutputInterface $output,
8686
): int {

src/Tools/Console/Command/ExecuteCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ protected function configure(): void
111111
parent::configure();
112112
}
113113

114-
protected function execute(InputInterface $input, OutputInterface $output): int
114+
protected function doExecute(InputInterface $input, OutputInterface $output): int
115115
{
116116
$migratorConfigurationFactory = $this->getDependencyFactory()->getConsoleInputMigratorConfigurationFactory();
117117
$migratorConfiguration = $migratorConfigurationFactory->getMigratorConfiguration($input);

src/Tools/Console/Command/GenerateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected function configure(): void
4141
parent::configure();
4242
}
4343

44-
protected function execute(InputInterface $input, OutputInterface $output): int
44+
protected function doExecute(InputInterface $input, OutputInterface $output): int
4545
{
4646
$migrationGenerator = $this->getDependencyFactory()->getMigrationGenerator();
4747

src/Tools/Console/Command/LatestCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected function configure(): void
2929
parent::configure();
3030
}
3131

32-
protected function execute(InputInterface $input, OutputInterface $output): int
32+
protected function doExecute(InputInterface $input, OutputInterface $output): int
3333
{
3434
$aliasResolver = $this->getDependencyFactory()->getVersionAliasResolver();
3535

src/Tools/Console/Command/ListCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected function configure(): void
4141
parent::configure();
4242
}
4343

44-
protected function execute(InputInterface $input, OutputInterface $output): int
44+
protected function doExecute(InputInterface $input, OutputInterface $output): int
4545
{
4646
$versions = $this->getSortedVersions(
4747
$this->getDependencyFactory()->getMigrationPlanCalculator()->getMigrations(), // available migrations

src/Tools/Console/Command/MigrateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ protected function configure(): void
139139
parent::configure();
140140
}
141141

142-
protected function execute(InputInterface $input, OutputInterface $output): int
142+
protected function doExecute(InputInterface $input, OutputInterface $output): int
143143
{
144144
$migratorConfigurationFactory = $this->getDependencyFactory()->getConsoleInputMigratorConfigurationFactory();
145145
$migratorConfiguration = $migratorConfigurationFactory->getMigratorConfiguration($input);

src/Tools/Console/Command/RollupCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function configure(): void
3737
EOT);
3838
}
3939

40-
protected function execute(InputInterface $input, OutputInterface $output): int
40+
protected function doExecute(InputInterface $input, OutputInterface $output): int
4141
{
4242
$question = sprintf(
4343
'WARNING! You are about to execute a migration in database "%s" that could result in schema changes and data loss. Are you sure you wish to continue?',

0 commit comments

Comments
 (0)