当前位置: 首页>>代码示例>>PHP>>正文


PHP Configuration::setMigrationsTableName方法代码示例

本文整理汇总了PHP中Doctrine\DBAL\Migrations\Configuration\Configuration::setMigrationsTableName方法的典型用法代码示例。如果您正苦于以下问题:PHP Configuration::setMigrationsTableName方法的具体用法?PHP Configuration::setMigrationsTableName怎么用?PHP Configuration::setMigrationsTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\DBAL\Migrations\Configuration\Configuration的用法示例。


在下文中一共展示了Configuration::setMigrationsTableName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: indexAction

 public function indexAction()
 {
     $container = $this->container;
     $conn = $this->get('doctrine')->getConnection();
     $dir = $container->getParameter('doctrine_migrations.dir_name');
     if (!file_exists($dir)) {
         mkdir($dir, 0777, true);
     }
     $configuration = new Configuration($conn);
     $configuration->setMigrationsNamespace($container->getParameter('doctrine_migrations.namespace'));
     $configuration->setMigrationsDirectory($dir);
     $configuration->registerMigrationsFromDirectory($dir);
     $configuration->setName($container->getParameter('doctrine_migrations.name'));
     $configuration->setMigrationsTableName($container->getParameter('doctrine_migrations.table_name'));
     $versions = $configuration->getMigrations();
     foreach ($versions as $version) {
         $migration = $version->getMigration();
         if ($migration instanceof ContainerAwareInterface) {
             $migration->setContainer($container);
         }
     }
     $migration = new Migration($configuration);
     $migrated = $migration->migrate();
     // ...
 }
开发者ID:ssone,项目名称:cms-bundle,代码行数:25,代码来源:MigrationController.php

示例2: boot

 /**
  * Bootstraps the application.
  *
  * This method is called after all services are registered
  * and should be used for "dynamic" configuration (whenever
  * a service must be requested).
  * @param Application $app
  */
 public function boot(Application $app)
 {
     if (php_sapi_name() === 'cli') {
         $app['console.commands'] = $app->extend('console.commands', function ($commands) use($app) {
             $migrationCommands = [new Proxy\DiffCommandProxy(), new Proxy\ExecuteCommandProxy(), new Proxy\GenerateCommandProxy(), new Proxy\LatestCommandProxy(), new Proxy\MigrateCommandProxy(), new Proxy\StatusCommandProxy(), new Proxy\VersionCommandProxy()];
             if (isset($app['migrations.directory'])) {
                 $config = new Configuration($app['db']);
                 $config->setMigrationsDirectory($app['migrations.directory']);
                 $config->setMigrationsNamespace('DocMigrations');
                 $config->setMigrationsTableName('doc_migrations');
                 $config->registerMigrationsFromDirectory($app['migrations.directory']);
                 /** @var AbstractCommand $cmd */
                 foreach ($migrationCommands as $cmd) {
                     $cmd->setMigrationConfiguration($config);
                 }
             }
             return array_merge($commands, $migrationCommands, [new Proxy\ClearMetadataCacheDoctrineCommand(), new Proxy\ClearQueryCacheDoctrineCommand(), new Proxy\ClearResultCacheDoctrineCommand(), new Proxy\ConvertMappingDoctrineCommand(), new Proxy\CreateSchemaDoctrineCommand(), new Proxy\DropSchemaDoctrineCommand(), new Proxy\EnsureProductionSettingsDoctrineCommand(), new Proxy\InfoDoctrineCommand(), new Proxy\RunDqlDoctrineCommand(), new Proxy\RunSqlDoctrineCommand(), new Proxy\UpdateSchemaDoctrineCommand(), new Proxy\UpdateSchemaDoctrineCommand(), new Proxy\ValidateSchemaCommand(), new Proxy\GenProxiesDoctrineCommand(), new CreateDatabaseDoctrineCommand(), new DropDatabaseDoctrineCommand()]);
         });
         if (isset($app['console'])) {
             $app['console'] = $app->share($app->extend('console', function (ConsoleApplication $consoleApplication) use($app) {
                 $helperSet = $consoleApplication->getHelperSet();
                 $helperSet->set(new ManagerRegistryHelper($app['doctrine']), 'doctrine');
                 return $consoleApplication;
             }));
         }
     }
 }
开发者ID:baohx2000,项目名称:doc,代码行数:35,代码来源:DocServiceProvider.php

示例3: migrateBadgeTables

 /**
  * @param Connection $connection
  * @param AppKernel  $kernel
  *
  * @throws \Claroline\MigrationBundle\Migrator\InvalidDirectionException
  * @throws \Claroline\MigrationBundle\Migrator\InvalidVersionException
  * @throws \Doctrine\DBAL\Migrations\MigrationException
  */
 protected function migrateBadgeTables(Connection $connection, AppKernel $kernel)
 {
     $portfolioBundle = $this->container->get('claroline.persistence.object_manager')->getRepository('ClarolineCoreBundle:Plugin')->findBy(array('vendorName' => 'Icap', 'bundleName' => 'PortfolioBundle'));
     $portfolioBundle = count($portfolioBundle) === 1 ? true : false;
     if (!$portfolioBundle && $connection->getSchemaManager()->tablesExist(['icap__portfolio_widget_badges'])) {
         $this->log('Deleting portfolios badges tables...');
         $connection->getSchemaManager()->dropTable('icap__portfolio_widget_badges_badge');
         $connection->getSchemaManager()->dropTable('icap__portfolio_widget_badges');
         $this->log('Portfolios badges tables deleted.');
     }
     if ($portfolioBundle && !$connection->getSchemaManager()->tablesExist(['icap__portfolio_widget_badges'])) {
         $badgeBundle = $kernel->getBundle('IcapBadgeBundle');
         $this->log('Executing migrations for portfolio interaction');
         $migrationsDir = "{$badgeBundle->getPath()}/Installation/Migrations";
         $migrationsName = "{$badgeBundle->getName()} migration";
         $migrationsNamespace = "{$badgeBundle->getNamespace()}\\Installation\\Migrations";
         $migrationsTableName = 'doctrine_' . strtolower($badgeBundle->getName()) . '_versions';
         $config = new Configuration($connection);
         $config->setName($migrationsName);
         $config->setMigrationsDirectory($migrationsDir);
         $config->setMigrationsNamespace($migrationsNamespace);
         $config->setMigrationsTableName($migrationsTableName);
         $config->registerMigrationsFromDirectory($migrationsDir);
         $migration = new Migration($config);
         $executedQueriesNumber = $migration->migrate('20150929141509');
         $this->log(sprintf('%d queries executed', $executedQueriesNumber));
     }
 }
开发者ID:claroline,项目名称:distribution,代码行数:36,代码来源:Updater060300.php

示例4: boot

 public function boot(Application $app)
 {
     $app['dispatcher']->addListener(ConsoleEvents::INIT, function (ConsoleEvent $event) use($app) {
         $console = $event->getConsole();
         $helpers = ['dialog' => new QuestionHelper()];
         if (isset($app['orm.em'])) {
             $helpers['em'] = new EntityManagerHelper($app['orm.em']);
         }
         $helperSet = new HelperSet($helpers);
         $console->setHelperSet($helperSet);
         $config = new Configuration($app['db']);
         $config->setMigrationsNamespace($app['db.migrations.namespace']);
         if ($app['db.migrations.path']) {
             $config->setMigrationsDirectory($app['db.migrations.path']);
             $config->registerMigrationsFromDirectory($app['db.migrations.path']);
         }
         if ($app['db.migrations.name']) {
             $config->setName($app['db.migrations.name']);
         }
         if ($app['db.migrations.table_name']) {
             $config->setMigrationsTableName($app['db.migrations.table_name']);
         }
         $commands = [new Command\DiffCommand(), new Command\ExecuteCommand(), new Command\GenerateCommand(), new Command\MigrateCommand(), new Command\StatusCommand(), new Command\VersionCommand()];
         foreach ($commands as $command) {
             /** @var \Doctrine\DBAL\Migrations\Tools\Console\Command\AbstractCommand $command */
             $command->setMigrationConfiguration($config);
             $console->add($command);
         }
     });
 }
开发者ID:quazardous,项目名称:silex-migration,代码行数:30,代码来源:MigrationsServiceProvider.php

示例5: preUpdate

 /**
  * @param Connection $connection
  * @param AppKernel  $kernel
  */
 public function preUpdate(Connection $connection, AppKernel $kernel)
 {
     /** @var \Symfony\Component\HttpKernel\Bundle\Bundle[] $bundles */
     $bundles = $kernel->getBundles();
     $isPortfolioBundleInstalled = false;
     foreach ($bundles as $bundle) {
         if ('IcapPortfolioBundle' === $bundle->getName()) {
             $isPortfolioBundleInstalled = true;
         }
     }
     if ($connection->getSchemaManager()->tablesExist(['icap__portfolio_widget_badges'])) {
         if ($isPortfolioBundleInstalled) {
             $this->log('Found existing database schema: skipping install migration...');
             $config = new Configuration($connection);
             $config->setMigrationsTableName('doctrine_icapbadgebundle_versions');
             $config->setMigrationsNamespace('claro_badge');
             // required but useless
             $config->setMigrationsDirectory('claro_badge');
             // idem
             try {
                 $version = new Version($config, '20150929141509', 'stdClass');
                 $version->markMigrated();
             } catch (\Exception $e) {
                 $this->log('Already migrated');
             }
         } else {
             $this->log('Deleting badges tables for portfolio...');
             $connection->getSchemaManager()->dropTable('icap__portfolio_widget_badges_badge');
             $connection->getSchemaManager()->dropTable('icap__portfolio_widget_badges');
             $this->log('badges tables for portfolio deleted.');
         }
     }
 }
开发者ID:claroline,项目名称:distribution,代码行数:37,代码来源:Updater060200.php

示例6: register

 /**
  * {@inheritdoc}
  */
 public function register(Container $c)
 {
     $c['migrations.apps'] = function ($c) {
         $apps = new Container();
         foreach ($c['migrations.options'] as $key => $options) {
             $apps[$key] = function () use($c, $key, $options) {
                 $db = $c['dbs'][$key];
                 return $c['migrations.create_app']($c['migrations.create_helpers']($db), $c['migrations.create_commands']($db, $options));
             };
         }
         return $apps;
     };
     $c['migrations.create_app'] = $c->protect(function ($helpers, $commands) {
         return ConsoleRunner::createApplication($helpers, $commands);
     });
     $c['migrations.create_helpers'] = $c->protect(function ($db) {
         return new HelperSet(['db' => new ConnectionHelper($db), 'dialog' => new QuestionHelper()]);
     });
     $c['migrations.create_commands'] = $c->protect(function ($db, $options) {
         $config = new Configuration($db);
         if (isset($options['namespace'])) {
             $config->setMigrationsNamespace($options['namespace']);
         }
         $config->setMigrationsDirectory($options['path']);
         $config->registerMigrationsFromDirectory($options['path']);
         if (isset($options['table'])) {
             $config->setMigrationsTableName($options['table']);
         }
         $commands = [new DiffCommand(), new ExecuteCommand(), new GenerateCommand(), new MigrateCommand(), new StatusCommand(), new VersionCommand()];
         foreach ($commands as $command) {
             $command->setMigrationConfiguration($config);
         }
         return $commands;
     });
 }
开发者ID:okeyaki,项目名称:silex-doctrine-migrations,代码行数:38,代码来源:DoctrineMigrationsServiceProvider.php

示例7: create

 public static function create(Connection $connection)
 {
     $directory = __DIR__ . "/../app/migrations";
     $configuration = new Configuration($connection);
     $configuration->setMigrationsNamespace('DoctrineMigrations');
     $configuration->setMigrationsTableName('migrations');
     $configuration->setMigrationsDirectory($directory);
     $configuration->registerMigrationsFromDirectory($directory);
     return $configuration;
 }
开发者ID:craklabs,项目名称:skeleton-service,代码行数:10,代码来源:MigrationConfiguration.php

示例8: configureMigrationsForBundle

 public static function configureMigrationsForBundle(Application $application, $bundle, Configuration $configuration)
 {
     $bundle = $application->getKernel()->getBundle($bundle);
     $dir = $bundle->getPath() . '/DoctrineMigrations';
     $configuration->setMigrationsNamespace($bundle->getNamespace() . '\\DoctrineMigrations');
     $configuration->setMigrationsDirectory($dir);
     $configuration->registerMigrationsFromDirectory($dir);
     $configuration->setName($bundle->getName() . ' Migrations');
     $configuration->setMigrationsTableName(Inflector::tableize($bundle->getName()) . '_migration_versions');
 }
开发者ID:faridos,项目名称:ServerGroveLiveChat,代码行数:10,代码来源:DoctrineCommand.php

示例9: getConfiguration

 /**
  * @param string   $dir
  * @param \Closure $outputWriter
  *
  * @return Configuration
  */
 private function getConfiguration($dir, \Closure $outputWriter = null)
 {
     $connection = $this->container->get('database_connection');
     $configuration = new Configuration($connection, new OutputWriter($outputWriter));
     $configuration->setMigrationsNamespace($this->container->getParameter('doctrine_migrations.namespace'));
     $configuration->setMigrationsDirectory($dir);
     $configuration->registerMigrationsFromDirectory($dir);
     $configuration->setName($this->container->getParameter('doctrine_migrations.name'));
     $configuration->setMigrationsTableName($this->container->getParameter('doctrine_migrations.table_name'));
     return $configuration;
 }
开发者ID:csbill,项目名称:csbill,代码行数:17,代码来源:Migration.php

示例10: buildVersion

 private function buildVersion($bundle, $version)
 {
     $bundle = strtolower($bundle);
     $config = new Configuration($this->connection);
     $config->setMigrationsTableName('doctrine_' . $bundle . '_versions');
     $config->setMigrationsNamespace(ucfirst($bundle));
     // required but useless
     $config->setMigrationsDirectory(ucfirst($bundle));
     // idem
     return new Version($config, $version, 'stdClass');
 }
开发者ID:claroline,项目名称:distribution,代码行数:11,代码来源:MigrationManager.php

示例11: configureMigrations

 public static function configureMigrations(ContainerInterface $container, Configuration $configuration)
 {
     if (!$configuration->getMigrationsDirectory()) {
         $dir = $container->getParameter('doctrine_migrations.dir_name');
         if (!file_exists($dir)) {
             mkdir($dir, 0777, true);
         }
         $configuration->setMigrationsDirectory($dir);
     } else {
         $dir = $configuration->getMigrationsDirectory();
         // class Kernel has method getKernelParameters with some of the important path parameters
         $pathPlaceholderArray = array('kernel.root_dir', 'kernel.cache_dir', 'kernel.logs_dir');
         foreach ($pathPlaceholderArray as $pathPlaceholder) {
             if ($container->hasParameter($pathPlaceholder) && preg_match('/\\%' . $pathPlaceholder . '\\%/', $dir)) {
                 $dir = str_replace('%' . $pathPlaceholder . '%', $container->getParameter($pathPlaceholder), $dir);
             }
         }
         if (!file_exists($dir)) {
             mkdir($dir, 0777, true);
         }
         $configuration->setMigrationsDirectory($dir);
     }
     if (!$configuration->getMigrationsNamespace()) {
         $configuration->setMigrationsNamespace($container->getParameter('doctrine_migrations.namespace'));
     }
     if (!$configuration->getName()) {
         $configuration->setName($container->getParameter('doctrine_migrations.name'));
     }
     // For backward compatibility, need use a table from parameters for overwrite the default configuration
     if (!$configuration->getMigrationsTableName() || !$configuration instanceof AbstractFileConfiguration) {
         $configuration->setMigrationsTableName($container->getParameter('doctrine_migrations.table_name'));
     }
     // Migrations is not register from configuration loader
     if (!$configuration instanceof AbstractFileConfiguration) {
         $configuration->registerMigrationsFromDirectory($configuration->getMigrationsDirectory());
     }
     if ($container->hasParameter('doctrine_migrations.organize_migrations')) {
         $organizeMigrations = $container->getParameter('doctrine_migrations.organize_migrations');
         switch ($organizeMigrations) {
             case Configuration::VERSIONS_ORGANIZATION_BY_YEAR:
                 $configuration->setMigrationsAreOrganizedByYear(true);
                 break;
             case Configuration::VERSIONS_ORGANIZATION_BY_YEAR_AND_MONTH:
                 $configuration->setMigrationsAreOrganizedByYearAndMonth(true);
                 break;
             case false:
                 break;
             default:
                 throw new InvalidConfigurationException('Unrecognized option "' . $organizeMigrations . '" under "organize_migrations"');
         }
     }
     self::injectContainerToMigrations($container, $configuration->getMigrations());
 }
开发者ID:dextervip,项目名称:DoctrineMigrationsBundle,代码行数:53,代码来源:DoctrineCommand.php

示例12: configureMigrations

 public static function configureMigrations(ContainerInterface $container, Configuration $configuration)
 {
     $dir = $container->getParameter('doctrine_migrations.dir_name');
     if (!file_exists($dir)) {
         mkdir($dir, 0777, true);
     }
     $configuration->setMigrationsNamespace($container->getParameter('doctrine_migrations.namespace'));
     $configuration->setMigrationsDirectory($dir);
     $configuration->registerMigrationsFromDirectory($dir);
     $configuration->setName($container->getParameter('doctrine_migrations.name'));
     $configuration->setMigrationsTableName($container->getParameter('doctrine_migrations.table_name'));
 }
开发者ID:noelg,项目名称:symfony-demo,代码行数:12,代码来源:DoctrineCommand.php

示例13: configureMigrations

 protected function configureMigrations(Container $container, Configuration $config)
 {
     $dir = $container['doctrine.migrations.dir_name'];
     if (!file_exists($dir)) {
         mkdir($dir, 0777, true);
     }
     $config->setMigrationsNamespace($container['doctrine.migrations.namespace']);
     $config->setMigrationsDirectory($dir);
     $config->registerMigrationsFromDirectory($dir);
     $config->setName($container['doctrine.migrations.name']);
     $config->setMigrationsTableName($container['doctrine.migrations.table_name']);
 }
开发者ID:rmasters,项目名称:doctrine-migrations-service-provider,代码行数:12,代码来源:DoctrineCommandTrait.php

示例14: migrationSchema

 public function migrationSchema($app, $migrationFilePath, $pluginCode, $version = null)
 {
     $config = new Configuration($app['db']);
     $config->setMigrationsNamespace('DoctrineMigrations');
     $config->setMigrationsDirectory($migrationFilePath);
     $config->registerMigrationsFromDirectory($migrationFilePath);
     $config->setMigrationsTableName(self::MIGRATION_TABLE_PREFIX . $pluginCode);
     $migration = new Migration($config);
     // null 又は 'last' を渡すと最新バージョンまでマイグレートする
     // 0か'first'を渡すと最初に戻る
     $migration->migrate($version, false);
 }
开发者ID:hiroyasu55,项目名称:ec-cube,代码行数:12,代码来源:AbstractPluginManager.php

示例15: configureMigrations

 protected function configureMigrations(ContainerInterface $container, Configuration $configuration)
 {
     $dir = $container->getParameter('ezpublish_migrations.dir_name');
     if (!file_exists($dir)) {
         mkdir($dir, 0777, true);
     }
     $configuration->setMigrationsNamespace($container->getParameter('ezpublish_migrations.namespace'));
     $configuration->setMigrationsDirectory($dir);
     $configuration->registerMigrationsFromDirectory($dir);
     $configuration->setName($container->getParameter('ezpublish_migrations.name'));
     $configuration->setMigrationsTableName($container->getParameter('ezpublish_migrations.table_name'));
     self::injectContainerToMigrations($container, $configuration->getMigrations());
 }
开发者ID:xrowgmbh,项目名称:ezpublish-migrations-bundle,代码行数:13,代码来源:CommandTrait.php


注:本文中的Doctrine\DBAL\Migrations\Configuration\Configuration::setMigrationsTableName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。