Symfony2:版本2.0.1和DoctrineMigrationsBundle

时间:2011-09-02 06:30:04

标签: php doctrine-orm symfony database-migration

所有! 到底是怎么回事 ? 今天我尝试从GitHub重新安装新版本的Symfony2(2.0.1)

$ app/vendors install --reinstall

用我的内核&自动加载器配置:

class AppKernel extends Kernel
{
  public function registerBundles()
  {
    $bundles = array(
      new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
      new Symfony\Bundle\SecurityBundle\SecurityBundle(),
      new Symfony\Bundle\TwigBundle\TwigBundle(),
      new Symfony\Bundle\MonologBundle\MonologBundle(),
      new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
      new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
      new Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesBundle(),
      new Symfony\Bundle\DoctrineMigrationsBundle\DoctrineMigrationsBundle(),
      ...

$loader->registerNamespaces(array(
  'Symfony'          => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'),
  'Sensio'           => __DIR__.'/../vendor/bundles',
  'JMS'              => __DIR__.'/../vendor/bundles',
  'Doctrine\\Common\\DataFixtures' => __DIR__.'/../vendor/doctrine-fixtures/lib',
  'Doctrine\\DBAL\\Migrations' => __DIR__.'/../vendor/doctrine-migrations/lib',
  'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib',
  'Doctrine\\DBAL'   => __DIR__.'/../vendor/doctrine-dbal/lib',
  'Doctrine'         => __DIR__.'/../vendor/doctrine/lib',
  'Monolog'          => __DIR__.'/../vendor/monolog/src',
  'Assetic'          => __DIR__.'/../vendor/assetic/src',
  'Metadata'         => __DIR__.'/../vendor/metadata/src',

));

文件[Symfony2-root] / deps

[doctrine-migrations]
  git=http://github.com/doctrine/migrations.git

[DoctrineMigrationsBundle]
  git=http://github.com/symfony/DoctrineMigrationsBundle.git

[doctrine-fixtures]
  git=http://github.com/doctrine/data-fixtures.git

[DoctrineFixturesBundle]
  git=http://github.com/symfony/DoctrineFixturesBundle.git
target=/bundles/Symfony/Bundle/DoctrineFixturesBundle

但有一个奇怪的错误: 致命错误:

中找不到“Symfony \ Bundle \ DoctrineMigrationsBundle \ DoctrineMigrationsBundle”类

有人知道发生了什么吗? 感谢

1 个答案:

答案 0 :(得分:3)

解决。 我的错误

我忘了在deps中添加一行

[DoctrineMigrationsBundle]
    git=http://github.com/symfony/DoctrineMigrationsBundle.git
    target=/bundles/Symfony/Bundle/DoctrineMigrationsBundle

而不是

[DoctrineMigrationsBundle]
    git=http://github.com/symfony/DoctrineMigrationsBundle.git

现在一切都好。