本文整理汇总了PHP中Doctrine\DBAL\Migrations\Configuration\Configuration::getMigratedVersions方法的典型用法代码示例。如果您正苦于以下问题:PHP Configuration::getMigratedVersions方法的具体用法?PHP Configuration::getMigratedVersions怎么用?PHP Configuration::getMigratedVersions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Migrations\Configuration\Configuration
的用法示例。
在下文中一共展示了Configuration::getMigratedVersions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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);
}
示例2: check
/**
* 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();
}
示例3: showVersions
private function showVersions($migrations, Configuration $configuration, OutputInterface $output)
{
$migratedVersions = $configuration->getMigratedVersions();
foreach ($migrations as $version) {
$isMigrated = in_array($version->getVersion(), $migratedVersions);
$status = $isMigrated ? '<info>migrated</info>' : '<error>not migrated</error>';
$migrationDescription = $version->getMigration()->getDescription() ? str_repeat(' ', 5) . $version->getMigration()->getDescription() : '';
$formattedVersion = $configuration->getDateTime($version->getVersion());
$output->writeln(' <comment>>></comment> ' . $formattedVersion . ' (<comment>' . $version->getVersion() . '</comment>)' . str_repeat(' ', 49 - strlen($formattedVersion) - strlen($version->getVersion())) . $status . $migrationDescription);
}
}
示例4: viewAction
/**
* @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')]);
}