Skip to content

Commit

Permalink
Progress bar fix related to validation before migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Hall committed Jan 27, 2020
1 parent 5db6c60 commit 0d32e3a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Objects/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,10 @@ public function migrate(): void

if ($this->validateBeforeMigrating) {
if ($this->showProgressBar) {
$this->progressBar = new ProgressBar();
$this->progressBar->setMessage('Validating...');
$this->progressBar->setMaxProgress($this->source->countPages() * count($this->destinationContainers));
$this->progressBar->display();
$progressBar = new ProgressBar();
$progressBar->setMessage('Validating...');
$progressBar->setMaxProgress($this->source->countPages() * count($this->destinationContainers));
$progressBar->display();
}

for ($page = 1; $page < PHP_INT_MAX; $page++) {
Expand All @@ -370,10 +370,12 @@ public function migrate(): void
$dataRow->validate($this->validationRules);
}

$this->advanceProgressBar();
if (isset($progressBar)) {
$progressBar->advance()->display();
}
}

if ($this->showProgressBar) {
if (isset($progressBar)) {
$this->progressBar->complete();
}
}
Expand Down

0 comments on commit 0d32e3a

Please sign in to comment.