• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Configuration\Configuration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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)
 {
     $helperSet = new HelperSet(array('connection' => new ConnectionHelper($app['db']), 'dialog' => new DialogHelper()));
     if (isset($app['orm.em'])) {
         $helperSet->set(new EntityManagerHelper($app['orm.em']), 'em');
     }
     $this->console->setHelperSet($helperSet);
     $commands = array('Doctrine\\DBAL\\Migrations\\Tools\\Console\\Command\\ExecuteCommand', 'Doctrine\\DBAL\\Migrations\\Tools\\Console\\Command\\GenerateCommand', 'Doctrine\\DBAL\\Migrations\\Tools\\Console\\Command\\MigrateCommand', 'Doctrine\\DBAL\\Migrations\\Tools\\Console\\Command\\StatusCommand', 'Doctrine\\DBAL\\Migrations\\Tools\\Console\\Command\\VersionCommand');
     // @codeCoverageIgnoreStart
     if (true === $this->console->getHelperSet()->has('em')) {
         $commands[] = 'Doctrine\\DBAL\\Migrations\\Tools\\Console\\Command\\DiffCommand';
     }
     // @codeCoverageIgnoreEnd
     $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']);
     foreach ($commands as $name) {
         /** @var AbstractCommand $command */
         $command = new $name();
         $command->setMigrationConfiguration($configuration);
         $this->console->add($command);
     }
 }
开发者ID:Leemo,项目名称:silex-doctrine-migrations-provider,代码行数:35,代码来源:DoctrineMigrationsProvider.php


示例2: getSqliteConfiguration

 /**
  * @return Configuration
  */
 public function getSqliteConfiguration()
 {
     $config = new Configuration($this->getSqliteConnection());
     $config->setMigrationsDirectory(\sys_get_temp_dir());
     $config->setMigrationsNamespace('DoctrineMigrations');
     return $config;
 }
开发者ID:pavsuri,项目名称:PARMT,代码行数:10,代码来源:MigrationTestCase.php


示例3: getConnection

 /**
  * @see http://jamesmcfadden.co.uk/database-unit-testing-with-doctrine-2-and-phpunit/
  */
 public function getConnection()
 {
     // 別途 Application を生成しているような箇所があると動作しないので注意
     $app = EccubeTestCase::createApplication();
     // Get an instance of your entity manager
     $entityManager = $app['orm.em'];
     // Retrieve PDO instance
     $pdo = $entityManager->getConnection()->getWrappedConnection();
     // Clear Doctrine to be safe
     $entityManager->clear();
     // Schema Tool to process our entities
     $tool = new \Doctrine\ORM\Tools\SchemaTool($entityManager);
     $classes = $entityManager->getMetaDataFactory()->getAllMetaData();
     // Drop all classes and re-build them for each test case
     $tool->dropSchema($classes);
     $tool->createSchema($classes);
     $config = new Configuration($app['db']);
     $config->setMigrationsNamespace('DoctrineMigrations');
     $migrationDir = __DIR__ . '/../../../src/Eccube/Resource/doctrine/migration';
     $config->setMigrationsDirectory($migrationDir);
     $config->registerMigrationsFromDirectory($migrationDir);
     $migration = new Migration($config);
     $migration->migrate(null, false);
     self::$app = $app;
     // Pass to PHPUnit
     return $this->createDefaultDBConnection($pdo, 'db_name');
 }
开发者ID:haou1945,项目名称:ec-cube,代码行数:30,代码来源:EccubeDatabaseTestCase.php


示例4: chosen

 /**
  * read the input and return a Configuration, returns `false` if the config
  * is not supported
  * @return Connection|null
  */
 public function chosen()
 {
     if ($this->configuration) {
         return $this->configuration->getConnection();
     }
     return null;
 }
开发者ID:DIPcom,项目名称:Sandmin,代码行数:12,代码来源:ConnectionConfigurationLoader.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: initializeDatabase

 /**
  * データベースを初期化する.
  *
  * データベースを初期化し、マイグレーションを行なう.
  * 全てのデータが初期化されるため注意すること.
  *
  * @link http://jamesmcfadden.co.uk/database-unit-testing-with-doctrine-2-and-phpunit/
  */
 public function initializeDatabase()
 {
     // Get an instance of your entity manager
     $entityManager = $this->app['orm.em'];
     // Retrieve PDO instance
     $pdo = $entityManager->getConnection()->getWrappedConnection();
     // Clear Doctrine to be safe
     $entityManager->clear();
     // Schema Tool to process our entities
     $tool = new \Doctrine\ORM\Tools\SchemaTool($entityManager);
     $classes = $entityManager->getMetaDataFactory()->getAllMetaData();
     // Drop all classes and re-build them for each test case
     $tool->dropSchema($classes);
     $tool->createSchema($classes);
     $config = new Configuration($this->app['db']);
     $config->setMigrationsNamespace('DoctrineMigrations');
     $migrationDir = __DIR__ . '/../../../src/Eccube/Resource/doctrine/migration';
     $config->setMigrationsDirectory($migrationDir);
     $config->registerMigrationsFromDirectory($migrationDir);
     $migration = new Migration($config);
     $migration->migrate(null, false);
     // 通常は eccube_install.sh で追加されるデータを追加する
     $sql = "INSERT INTO dtb_member (member_id, login_id, password, salt, work, del_flg, authority, creator_id, rank, update_date, create_date,name,department) VALUES (2, 'admin', 'test', 'test', 1, 0, 0, 1, 1, current_timestamp, current_timestamp,'管理者','EC-CUBE SHOP')";
     $stmt = $pdo->prepare($sql);
     $stmt->execute();
     $sql = "INSERT INTO dtb_base_info (id, shop_name, email01, email02, email03, email04, update_date, option_product_tax_rule) VALUES (1, 'SHOP_NAME', '[email protected]', '[email protected]', '[email protected]', '[email protected]', current_timestamp, 0)";
     $stmt = $pdo->prepare($sql);
     $stmt->execute();
 }
开发者ID:nahaichuan,项目名称:ec-cube,代码行数:37,代码来源:EccubeTestCase.php


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


示例8: __construct

 public function __construct(Version $version)
 {
     $this->configuration = $version->getConfiguration();
     $this->outputWriter = $this->configuration->getOutputWriter();
     $this->connection = $this->configuration->getConnection();
     $this->sm = $this->connection->getSchemaManager();
     $this->platform = $this->connection->getDatabasePlatform();
     $this->version = $version;
 }
开发者ID:glaucosydow,项目名称:curso-zf2,代码行数:9,代码来源:AbstractMigration.php


示例9: outputHeader

 protected function outputHeader(Configuration $configuration, OutputInterface $output)
 {
     $name = $configuration->getName();
     $name = $name ? $name : 'Doctrine Database Migrations';
     $name = str_repeat(' ', 20) . $name . str_repeat(' ', 20);
     $output->writeln('<question>' . str_repeat(' ', strlen($name)) . '</question>');
     $output->writeln('<question>' . $name . '</question>');
     $output->writeln('<question>' . str_repeat(' ', strlen($name)) . '</question>');
     $output->writeln('');
 }
开发者ID:glaucosydow,项目名称:curso-zf2,代码行数:10,代码来源:AbstractCommand.php


示例10: __construct

 public function __construct(Configuration $configuration, $version, $class)
 {
     $this->_configuration = $configuration;
     $this->_outputWriter = $configuration->getOutputWriter();
     $this->_version = $version;
     $this->_class = $class;
     $this->_connection = $configuration->getConnection();
     $this->_sm = $this->_connection->getSchemaManager();
     $this->_platform = $this->_connection->getDatabasePlatform();
     $this->_migration = new $class($this);
 }
开发者ID:poulikov,项目名称:readlater,代码行数:11,代码来源:Version.php


示例11: 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);
     }
 }
开发者ID:doctrine,项目名称:migrations,代码行数:11,代码来源:StatusCommand.php


示例12: _buildCodeFromSql

 private function _buildCodeFromSql(Configuration $configuration, array $sql)
 {
     $code = array();
     foreach ($sql as $query) {
         if (strpos($query, $configuration->getMigrationsTableName()) !== false) {
             continue;
         }
         $code[] = "\$this->_addSql('" . $query . "');";
     }
     return implode("\n", $code);
 }
开发者ID:klaasn,项目名称:symfony-sandbox,代码行数:11,代码来源:DiffCommand.php


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


示例14: buildCodeFromSql

 private function buildCodeFromSql(Configuration $configuration, array $sql)
 {
     $currentPlatform = $configuration->getConnection()->getDatabasePlatform()->getName();
     $code = array("\$this->abortIf(\$this->connection->getDatabasePlatform()->getName() != \"{$currentPlatform}\", \"Migration can only be executed safely on '{$currentPlatform}'.\");", "");
     foreach ($sql as $query) {
         if (strpos($query, $configuration->getMigrationsTableName()) !== false) {
             continue;
         }
         $code[] = "\$this->addSql(\"{$query}\");";
     }
     return implode("\n", $code);
 }
开发者ID:axelvnk,项目名称:KunstmaanBundlesCMS,代码行数:12,代码来源:DiffCommand.php


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


示例16: initializeDatabase

 /**
  * データベースを初期化する.
  *
  * データベースを初期化し、マイグレーションを行なう.
  * 全てのデータが初期化されるため注意すること.
  *
  * @link http://jamesmcfadden.co.uk/database-unit-testing-with-doctrine-2-and-phpunit/
  */
 public function initializeDatabase()
 {
     // Get an instance of your entity manager
     $entityManager = $this->app['orm.em'];
     // Retrieve PDO instance
     $pdo = $entityManager->getConnection()->getWrappedConnection();
     // Clear Doctrine to be safe
     $entityManager->getConnection()->getConfiguration()->setSQLLogger(null);
     $entityManager->clear();
     gc_collect_cycles();
     // Schema Tool to process our entities
     $tool = new \Doctrine\ORM\Tools\SchemaTool($entityManager);
     $classes = $entityManager->getMetaDataFactory()->getAllMetaData();
     // Drop all classes and re-build them for each test case
     $tool->dropSchema($classes);
     $tool->createSchema($classes);
     $config = new Configuration($this->app['db']);
     $config->setMigrationsNamespace('DoctrineMigrations');
     $migrationDir = __DIR__ . '/../../../src/Eccube/Resource/doctrine/migration';
     $config->setMigrationsDirectory($migrationDir);
     $config->registerMigrationsFromDirectory($migrationDir);
     $migration = new Migration($config);
     // initialize migrations.sql from bootstrap
     if (!file_exists(sys_get_temp_dir() . '/migrations.sql')) {
         $sql = $migration->migrate(null, false);
         file_put_contents(sys_get_temp_dir() . '/migrations.sql', json_encode($sql));
     } else {
         $migrations = json_decode(file_get_contents(sys_get_temp_dir() . '/migrations.sql'), true);
         foreach ($migrations as $migration_sql) {
             foreach ($migration_sql as $sql) {
                 if ($this->isSqliteInMemory()) {
                     // XXX #1199 の問題を無理矢理回避...
                     $sql = preg_replace('/CURRENT_TIMESTAMP/i', "datetime('now','-9 hours')", $sql);
                 }
                 $stmt = $pdo->prepare($sql);
                 $stmt->execute();
                 $stmt->closeCursor();
             }
         }
     }
     // 通常は eccube_install.sh で追加されるデータを追加する
     $sql = "INSERT INTO dtb_member (member_id, login_id, password, salt, work, del_flg, authority, creator_id, rank, update_date, create_date,name,department) VALUES (2, 'admin', 'test', 'test', 1, 0, 0, 1, 1, current_timestamp, current_timestamp,'管理者','EC-CUBE SHOP')";
     $stmt = $pdo->prepare($sql);
     $stmt->execute();
     $stmt->closeCursor();
     $sql = "INSERT INTO dtb_base_info (id, shop_name, email01, email02, email03, email04, update_date, option_product_tax_rule) VALUES (1, 'SHOP_NAME', '[email protected]', '[email protected]', '[email protected]', '[email protected]', current_timestamp, 0)";
     $stmt = $pdo->prepare($sql);
     $stmt->execute();
     $stmt->closeCursor();
 }
开发者ID:shhirose,项目名称:ec-cube,代码行数:58,代码来源:EccubeTestCase.php


示例17: skipInstallIfMigratingFromCore

 private function skipInstallIfMigratingFromCore()
 {
     if ($this->conn->getSchemaManager()->tablesExist(['claro_event'])) {
         $this->log('Found existing database schema: skipping install migration...');
         $config = new Configuration($this->conn);
         $config->setMigrationsTableName('doctrine_clarolineagendabundle_versions');
         $config->setMigrationsNamespace('claro_event');
         // required but useless
         $config->setMigrationsDirectory('claro_event');
         // idem
         $version = new Version($config, '20150429110105', 'stdClass');
         $version->markMigrated();
     }
 }
开发者ID:claroline,项目名称:distribution,代码行数:14,代码来源:MigrationUpdater.php


示例18: 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();
 }
开发者ID:atulhere,项目名称:zendPractice,代码行数:19,代码来源:DoctrineMigration.php


示例19: getConsoleCommands

 /**
  * @param HelperSet $helperSet
  *
  * @return array
  */
 public function getConsoleCommands(HelperSet $helperSet)
 {
     $configuration = new Configuration($this->em->getConnection());
     $configuration->setMigrationsNamespace($this->config->getMigrationsNamespace());
     $configuration->setMigrationsDirectory($this->config->getMigrationsPath());
     $configuration->setMigrationsTableName($this->config->getMigrationsTable());
     $commands = [new DiffCommand(), new ExecuteCommand(), new GenerateCommand(), new LatestCommand(), new MigrateCommand(), new StatusCommand(), new VersionCommand()];
     /** @var AbstractCommand $command */
     foreach ($commands as $command) {
         $command->setHelperSet($helperSet);
         $command->setMigrationConfiguration($configuration);
     }
     return $commands;
 }
开发者ID:weew,项目名称:app-doctrine,代码行数:19,代码来源:DoctrineConsoleRunner.php


示例20: preInstall

 public function preInstall()
 {
     if ($this->conn->getSchemaManager()->tablesExist(['claro_message'])) {
         $this->log('Found existing database schema: skipping install migration...');
         $config = new Configuration($this->conn);
         $config->setMigrationsTableName('doctrine_clarolinemessagebundle_versions');
         $config->setMigrationsNamespace('claro_message');
         // required but useless
         $config->setMigrationsDirectory('claro_message');
         // idem
         $version = new Version($config, '20150429114010', 'stdClass');
         $version->markMigrated();
     }
 }
开发者ID:claroline,项目名称:distribution,代码行数:14,代码来源:MigrationUpdater.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Platforms\AbstractPlatform类代码示例发布时间:2022-05-23
下一篇:
PHP DBAL\DriverManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap