diff --git a/lib/Doctrine/DBAL/Migrations/Tools/Console/Helper/MigrationStatusInfosHelper.php b/lib/Doctrine/DBAL/Migrations/Tools/Console/Helper/MigrationStatusInfosHelper.php
index 85fd21ddee..616ff98bdf 100644
--- a/lib/Doctrine/DBAL/Migrations/Tools/Console/Helper/MigrationStatusInfosHelper.php
+++ b/lib/Doctrine/DBAL/Migrations/Tools/Console/Helper/MigrationStatusInfosHelper.php
@@ -31,22 +31,6 @@ public function __construct(Configuration $configuration)
public function getMigrationsInfos()
{
- $formattedVersions = [];
- foreach (['prev', 'current', 'next', 'latest'] as $alias) {
- $version = $this->configuration->resolveVersionAlias($alias);
- if ($version === null) {
- if ($alias == 'next') {
- $formattedVersions[$alias] = 'Already at latest version';
- } elseif ($alias == 'prev') {
- $formattedVersions[$alias] = 'Already at first version';
- }
- } elseif ($version === '0') {
- $formattedVersions[$alias] = '0';
- } else {
- $formattedVersions[$alias] = $this->configuration->getDateTime($version) . ' (' . $version . ')';
- }
- }
-
$numExecutedUnavailableMigrations = count($this->executedUnavailableMigrations);
$numNewMigrations = count(array_diff($this->availableMigrations, $this->executedMigrations));
@@ -59,10 +43,10 @@ public function getMigrationsInfos()
'Version Column Name' => $this->configuration->getMigrationsColumnName(),
'Migrations Namespace' => $this->configuration->getMigrationsNamespace(),
'Migrations Directory' => $this->configuration->getMigrationsDirectory(),
- 'Previous Version' => $formattedVersions['prev'],
- 'Current Version' => $formattedVersions['current'],
- 'Next Version' => $formattedVersions['next'],
- 'Latest Version' => $formattedVersions['latest'],
+ 'Previous Version' => $this->getFormattedVersionAlias('prev'),
+ 'Current Version' => $this->getFormattedVersionAlias('current'),
+ 'Next Version' => $this->getFormattedVersionAlias('next'),
+ 'Latest Version' => $this->getFormattedVersionAlias('latest'),
'Executed Migrations' => count($this->executedMigrations),
'Executed Unavailable Migrations' => $numExecutedUnavailableMigrations,
'Available Migrations' => count($this->availableMigrations),
@@ -72,6 +56,30 @@ public function getMigrationsInfos()
return $infos;
}
+ private function getFormattedVersionAlias($alias)
+ {
+ $version = $this->configuration->resolveVersionAlias($alias);
+ //No version found
+ if ($version === null) {
+ if ($alias == 'next') {
+
+ return 'Already at latest version';
+ } elseif ($alias == 'prev') {
+
+ return 'Already at first version';
+ }
+ }
+ //Before first version "virtual" version number
+ if ($version === '0') {
+
+ return '0';
+ }
+
+ //Show normal version number
+ return $this->configuration->getDateTime($version) . ' (' . $version . ')';
+
+ }
+
/** @var Version[] */
public function getExecutedUnavailableMigrations()
{