Skip to content

Commit

Permalink
[EntityMigrator] Improve progress display
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoiriert committed Nov 1, 2023
1 parent 9cc9c00 commit 70afdb0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/entity-migrator/Command/MigrateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Draw\Component\EntityMigrator\Entity\Migration;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
Expand Down Expand Up @@ -43,13 +44,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return Command::SUCCESS;
}

$progress = $io->createProgressBar($count ?? 0);

$manager = $this->managerRegistry->getManagerForClass(Migration::class);

\assert($manager instanceof EntityManagerInterface);

$realCount = 0;

$progress = $io->createProgressBar($count ?? 0);
$progress->setFormat(ProgressBar::FORMAT_DEBUG);
foreach ($migration->findAllThatNeedMigration() as $entity) {
$entityMigration = $this->entityMigrationRepository->load(
$entity,
Expand Down
3 changes: 2 additions & 1 deletion packages/entity-migrator/Command/QueueBatchCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Draw\Component\EntityMigrator\Repository\EntityMigrationRepository;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
Expand Down Expand Up @@ -124,7 +125,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
->toIterable();

$progress = $io->createProgressBar($count);

$progress->setFormat(ProgressBar::FORMAT_DEBUG);
foreach ($result as $row) {
$migrationEntity = $manager->getReference($entityMigrationClass, $row['id']);

Expand Down

0 comments on commit 70afdb0

Please sign in to comment.