當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Configuration::getDateTime方法代碼示例

本文整理匯總了PHP中Doctrine\DBAL\Migrations\Configuration\Configuration::getDateTime方法的典型用法代碼示例。如果您正苦於以下問題:PHP Configuration::getDateTime方法的具體用法?PHP Configuration::getDateTime怎麽用?PHP Configuration::getDateTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\DBAL\Migrations\Configuration\Configuration的用法示例。


在下文中一共展示了Configuration::getDateTime方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getFormattedVersionAlias

 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 '<comment>0</comment>';
     }
     //Show normal version number
     return $this->configuration->getDateTime($version) . ' (<comment>' . $version . '</comment>)';
 }
開發者ID:DIPcom,項目名稱:Sandmin,代碼行數:18,代碼來源:MigrationStatusInfosHelper.php

示例2: getMigrationsInfos

 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] = '<comment>0</comment>';
         } else {
             $formattedVersions[$alias] = $this->configuration->getDateTime($version) . ' (<comment>' . $version . '</comment>)';
         }
     }
     $numExecutedUnavailableMigrations = count($this->executedUnavailableMigrations);
     $numNewMigrations = count(array_diff($this->availableMigrations, $this->executedMigrations));
     $infos = ['Name' => $this->configuration->getName() ? $this->configuration->getName() : 'Doctrine Database Migrations', 'Database Driver' => $this->configuration->getConnection()->getDriver()->getName(), 'Database Name' => $this->configuration->getConnection()->getDatabase(), 'Configuration Source' => $this->configuration instanceof AbstractFileConfiguration ? $this->configuration->getFile() : 'manually configured', 'Version Table Name' => $this->configuration->getMigrationsTableName(), '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'], 'Executed Migrations' => count($this->executedMigrations), 'Executed Unavailable Migrations' => $numExecutedUnavailableMigrations, 'Available Migrations' => count($this->availableMigrations), 'New Migrations' => $numNewMigrations];
     return $infos;
 }
開發者ID:itkg-jfranclin,項目名稱:migrations,代碼行數:22,代碼來源:MigrationStatusInfosHelper.php

示例3: 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')]);
 }
開發者ID:markei,項目名稱:doctrinemigrationwebbundle,代碼行數:25,代碼來源:MigrateController.php

示例4: showVersions

 private function showVersions($migrations, Configuration $configuration, $output)
 {
     $migratedVersions = $configuration->getMigratedVersions();
     foreach ($migrations as $version) {
         $isMigrated = in_array($version->getVersion(), $migratedVersions);
         $status = $isMigrated ? '<info>migrated</info>' : '<error>not migrated</error>';
         $migrationDescription = '';
         if ($version->getMigration()->getDescription()) {
             $migrationDescription = 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);
     }
 }
開發者ID:BiffBangPow,項目名稱:migrations,代碼行數:14,代碼來源:StatusCommand.php

示例5: getFormattedVersionAlias

 /**
  * Returns a formatted version string for the alias.
  *
  * @param string $alias
  * @param Configuration $configuration
  * @return string
  */
 protected function getFormattedVersionAlias($alias, Configuration $configuration)
 {
     $version = $configuration->resolveVersionAlias($alias);
     if ($version === null) {
         if ($alias == 'next') {
             return 'Already at latest version';
         } elseif ($alias == 'prev') {
             return 'Already at first version';
         }
     }
     if ($version === '0') {
         return '<comment>0</comment>';
     }
     return $configuration->getDateTime($version) . ' (<comment>' . $version . '</comment>)';
 }
開發者ID:fcool,項目名稱:flow-development-collection,代碼行數:22,代碼來源:Service.php


注:本文中的Doctrine\DBAL\Migrations\Configuration\Configuration::getDateTime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。