Skip to content

Commit 0d32e3a

Browse files
author
Jordan Hall
committed
Progress bar fix related to validation before migration
1 parent 5db6c60 commit 0d32e3a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Objects/Migrator.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,10 @@ public function migrate(): void
353353

354354
if ($this->validateBeforeMigrating) {
355355
if ($this->showProgressBar) {
356-
$this->progressBar = new ProgressBar();
357-
$this->progressBar->setMessage('Validating...');
358-
$this->progressBar->setMaxProgress($this->source->countPages() * count($this->destinationContainers));
359-
$this->progressBar->display();
356+
$progressBar = new ProgressBar();
357+
$progressBar->setMessage('Validating...');
358+
$progressBar->setMaxProgress($this->source->countPages() * count($this->destinationContainers));
359+
$progressBar->display();
360360
}
361361

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

373-
$this->advanceProgressBar();
373+
if (isset($progressBar)) {
374+
$progressBar->advance()->display();
375+
}
374376
}
375377

376-
if ($this->showProgressBar) {
378+
if (isset($progressBar)) {
377379
$this->progressBar->complete();
378380
}
379381
}

0 commit comments

Comments
 (0)