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


PHP Configuration::setName方法代码示例

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


在下文中一共展示了Configuration::setName方法的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: generateMigrationSql

 public function generateMigrationSql($return, &$hasMigrations)
 {
     $config = \Config::getInstance();
     $modules = $config->getActiveModules();
     $connection = $GLOBALS['container']['doctrine.connection.default'];
     $output = new OutputWriter();
     foreach ($modules as $module) {
         $path = sprintf('%s/system/modules/%s/migrations', TL_ROOT, $module);
         if (is_dir($path)) {
             $namespace = preg_split('~[\\-_]~', $module);
             $namespace = array_map('ucfirst', $namespace);
             $namespace = implode('', $namespace);
             $configuration = new Configuration($connection, $output);
             $configuration->setName($module);
             $configuration->setMigrationsNamespace('DoctrineMigrations\\' . $namespace);
             $configuration->setMigrationsDirectory($path);
             $configuration->registerMigrationsFromDirectory($path);
             $migration = new Migration($configuration);
             $versions = $migration->getSql();
             if (count($versions)) {
                 foreach ($versions as $version => $queries) {
                     if (count($queries)) {
                         $_SESSION['TL_CONFIRM'][] = sprintf($GLOBALS['TL_LANG']['doctrine']['migration'], $module, $version);
                         $hasMigrations = true;
                         $return = $this->appendQueries($return, $queries);
                     }
                 }
             }
         }
     }
     return $return;
 }
开发者ID:bit3,项目名称:contao-doctrine-orm,代码行数:32,代码来源:DbTool.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: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: configureMigrationsForBundle

 public static function configureMigrationsForBundle(Application $application, $bundle, Configuration $configuration)
 {
     $configuration->setMigrationsNamespace($bundle . '\\DoctrineMigrations');
     $dirs = $application->getKernel()->getBundleDirs();
     $tmp = str_replace('\\', '/', $bundle);
     $namespace = str_replace('/', '\\', dirname($tmp));
     $bundle = basename($tmp);
     $dir = $dirs[$namespace] . '/' . $bundle . '/DoctrineMigrations';
     $configuration->setMigrationsDirectory($dir);
     $configuration->registerMigrationsFromDirectory($dir);
     $configuration->setName($bundle . ' Migrations');
     $configuration->setMigrationsTableName(Inflector::tableize($bundle) . '_migration_versions');
 }
开发者ID:bill97420,项目名称:symfony,代码行数:13,代码来源:DoctrineCommand.php

示例11: 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

示例12: createService

 /**
  * {@inheritDoc}
  *
  * @return \Doctrine\DBAL\Migrations\Configuration\Configuration
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $name = $this->getName();
     /* @var $connection \Doctrine\DBAL\Connection */
     $connection = $serviceLocator->get('doctrine.connection.' . $name);
     $appConfig = $serviceLocator->get('Config');
     $migrationsConfig = $appConfig['doctrine']['migrations_configuration'][$name];
     $configuration = new Configuration($connection);
     $configuration->setName($migrationsConfig['name']);
     $configuration->setMigrationsDirectory($migrationsConfig['directory']);
     $configuration->setMigrationsNamespace($migrationsConfig['namespace']);
     $configuration->setMigrationsTableName($migrationsConfig['table']);
     $configuration->registerMigrationsFromDirectory($migrationsConfig['directory']);
     return $configuration;
 }
开发者ID:bantudevelopment,项目名称:polysmis,代码行数:20,代码来源:MigrationsConfigurationFactory.php

示例13: loadProviders

 public function loadProviders(Application $app)
 {
     $app->register(new Provider\MonologServiceProvider(), $app['monolog.config']);
     $app->register(new Provider\DoctrineServiceProvider());
     // connect to db
     //        \SimpleRecord\Record::connection($app['db']);
     $models = ['post.model' => 'App\\Model\\Post', 'tag.model' => 'App\\Model\\Tag', 'post_tags.model' => 'App\\Model\\PostTags'];
     foreach ($models as $name => $class) {
         if (is_callable($class)) {
             $callable = $class;
         } else {
             $callable = function () use($class, $app) {
                 return new $class($app);
             };
         }
         $app[$name] = $app->factory($callable);
     }
     $app['migrations.output_writer'] = new OutputWriter(function ($message) {
         $output = new ConsoleOutput();
         $output->writeln($message);
     });
     $app['migrations.configuration'] = function () use($app) {
         $configuration = new Configuration($app['db'], $app['migrations.output_writer']);
         $configuration->setMigrationsDirectory($app['migrations']['directory']);
         $configuration->setName($app['migrations']['name']);
         $configuration->setMigrationsNamespace($app['migrations']['namespace']);
         $configuration->setMigrationsTableName($app['migrations']['table_name']);
         $configuration->registerMigrationsFromDirectory($app['migrations']['directory']);
         return $configuration;
     };
     $app->register(new Provider\TwigServiceProvider(), ['twig.path' => $app['root.path'] . '/templates/', 'twig.form.templates' => ['bootstrap_3_horizontal_layout.html.twig'], 'twig.options' => ['cache' => $app['cache.path'] . '/twig']]);
     $app->register(new Provider\AssetServiceProvider(), ['assets.named_packages' => ['css' => ['version' => 'v1', 'base_path' => '/asset/css'], 'js' => ['version' => 'v1', 'base_path' => '/asset/js']]]);
     $app->register(new Provider\SecurityServiceProvider());
     $app->register(new Provider\RoutingServiceProvider());
     //        $app->register(new Silex\Provider\HttpCacheServiceProvider(), [
     //            'http_cache.cache_dir' => $app['cache.path'] . '/http',
     //        ]);
     //        $app->register(new Silex\Provider\HttpFragmentServiceProvider());
     $app->register(new Provider\ValidatorServiceProvider());
     $app->register(new Provider\LocaleServiceProvider());
     $app->register(new Provider\TranslationServiceProvider());
     $app->register(new Provider\CsrfServiceProvider());
     $app->register(new Provider\FormServiceProvider());
     $app->register(new Provider\ServiceControllerServiceProvider());
     $app->register(new Provider\SessionServiceProvider());
     $app->register(new \Paginator\Provider\PaginatorServiceProvider());
     //        $app->register(new \Sorien\Provider\PimpleDumpProvider(), ['dump.path' => $app['root.path']]);
 }
开发者ID:arduanov,项目名称:silex-app,代码行数:48,代码来源:Application.php

示例14: executeAction

 /**
  * @Route("/{connectionName}/execute/{version}")
  * @Method("POST")
  */
 public function executeAction($connectionName, $version)
 {
     $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);
     $currentVersion = $configuration->getCurrentVersion();
     $dryRun = false;
     $migration->setNoMigrationException(true);
     $sql = $migration->migrate($version, $dryRun, true);
     return $this->render('MarkeiDoctrineMigrationWebBundle:Migrate:execute.html.twig', ['connectionName' => $connectionName, 'to' => $version, 'from' => $currentVersion, 'output' => $outputWriter->getMemory(), 'name' => $this->container->getParameter('doctrine_migrations.name')]);
 }
开发者ID:markei,项目名称:doctrinemigrationwebbundle,代码行数:21,代码来源:MigrateController.php

示例15: __invoke

 /**
  * {@inheritDoc}
  *
  * @return \Doctrine\DBAL\Migrations\Configuration\Configuration
  */
 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
 {
     $name = $this->getName();
     /* @var $connection \Doctrine\DBAL\Connection */
     $connection = $container->get('doctrine.connection.' . $name);
     $appConfig = $container->get('Config');
     $migrationsConfig = $appConfig['doctrine']['migrations_configuration'][$name];
     $configuration = new Configuration($connection);
     $configuration->setName($migrationsConfig['name']);
     $configuration->setMigrationsDirectory($migrationsConfig['directory']);
     $configuration->setMigrationsNamespace($migrationsConfig['namespace']);
     $configuration->setMigrationsTableName($migrationsConfig['table']);
     $configuration->registerMigrationsFromDirectory($migrationsConfig['directory']);
     if (method_exists($configuration, 'setMigrationsColumnName')) {
         $configuration->setMigrationsColumnName($migrationsConfig['column']);
     }
     return $configuration;
 }
开发者ID:fanst1109,项目名称:doctrine-orm-module,代码行数:23,代码来源:MigrationsConfigurationFactory.php


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