getAvailableVersions() public méthode

Returns an array of available migration version numbers.
public getAvailableVersions ( ) : array
Résultat array
 private function markVersionsMigrated()
 {
     foreach ($this->migrations->getAvailableVersions() as $versionIdentifier) {
         $version = $this->migrations->getVersion($versionIdentifier);
         $version->markMigrated();
     }
 }
 public function __construct(Configuration $configuration)
 {
     $this->configuration = $configuration;
     $this->executedMigrations = $this->configuration->getMigratedVersions();
     $this->availableMigrations = $this->configuration->getAvailableVersions();
     $this->executedUnavailableMigrations = array_diff($this->executedMigrations, $this->availableMigrations);
 }
 /**
  * Perform the actual check and return a ResultInterface
  *
  * @return ResultInterface
  */
 public function check()
 {
     $availableVersions = $this->migrationConfiguration->getAvailableVersions();
     $migratedVersions = $this->migrationConfiguration->getMigratedVersions();
     $notMigratedVersions = array_diff($availableVersions, $migratedVersions);
     if (!empty($notMigratedVersions)) {
         return new Failure('Not all migrations applied', $notMigratedVersions);
     }
     $notAvailableVersion = array_diff($migratedVersions, $availableVersions);
     if (!empty($notAvailableVersion)) {
         return new Failure('Migrations applied which are not available', $notMigratedVersions);
     }
     return new Success();
 }
 private function markVersions(InputInterface $input)
 {
     $affectedVersion = $input->getArgument('version');
     $allOption = $input->getOption('all');
     $rangeFromOption = $input->getOption('range-from');
     $rangeToOption = $input->getOption('range-to');
     if ($allOption && ($rangeFromOption !== null || $rangeToOption !== null)) {
         throw new \InvalidArgumentException('Options --all and --range-to/--range-from both used. You should use only one of them.');
     } elseif ($rangeFromOption !== null ^ $rangeToOption !== null) {
         throw new \InvalidArgumentException('Options --range-to and --range-from should be used together.');
     }
     if ($allOption === true) {
         $availableVersions = $this->configuration->getAvailableVersions();
         foreach ($availableVersions as $version) {
             $this->mark($version, true);
         }
     } elseif ($rangeFromOption !== null && $rangeToOption !== null) {
         $availableVersions = $this->configuration->getAvailableVersions();
         foreach ($availableVersions as $version) {
             if ($version >= $rangeFromOption && $version <= $rangeToOption) {
                 $this->mark($version, true);
             }
         }
     } else {
         $this->mark($affectedVersion);
     }
 }
 private function markAllAvailableVersions(InputInterface $input)
 {
     $version = $input->getArgument('version');
     if ($input->getOption('all') === true) {
         $availableVersions = $this->configuration->getAvailableVersions();
         foreach ($availableVersions as $version) {
             $this->mark($version, true);
         }
     } else {
         $this->mark($version);
     }
 }
 /**
  * @Route("/{connectionName}/")
  */
 public function viewAction($connectionName)
 {
     $connection = $this->getDoctrine()->getConnection($connectionName);
     $outputWriter = new MemoryOutputWriter();
     $configuration = new Configuration($connection);
     $configuration->setName($this->container->getParameter('doctrine_migrations.name'));
     $configuration->setOutputWriter($outputWriter);
     $configuration->setMigrationsTableName($this->container->getParameter('doctrine_migrations.table_name'));
     $configuration->setMigrationsDirectory($this->container->getParameter('doctrine_migrations.dir_name'));
     $configuration->setMigrationsNamespace($this->container->getParameter('doctrine_migrations.namespace'));
     $migration = new Migration($configuration);
     $executedMigrations = $configuration->getMigratedVersions();
     $availableMigrations = $configuration->getAvailableVersions();
     $executedUnavailableMigrations = array_diff($executedMigrations, $availableMigrations);
     foreach ($executedUnavailableMigrations as $i => $executedUnavailableMigration) {
         $executedUnavailableMigrations[$i] = $executedUnavailableMigration . ' (' . $configuration->getDateTime($executedUnavailableMigration) . ')';
     }
     $dryRun = true;
     $migration->setNoMigrationException(true);
     $sql = $migration->migrate(null, $dryRun);
     return $this->render('MarkeiDoctrineMigrationWebBundle:Migrate:view.html.twig', ['connectionName' => $connectionName, 'executedUnavailableMigrations' => $executedUnavailableMigrations, 'to' => $configuration->getLatestVersion(), 'from' => $configuration->getCurrentVersion(), 'migrations' => $sql, 'name' => $this->container->getParameter('doctrine_migrations.name')]);
 }
 public function getAvailableVersions()
 {
     $this->doRegister();
     return parent::getAvailableVersions();
 }