stamas
stamas

Reputation: 397

Symfony2 DoctrineFixturesBundle namespace error

I have a big problem with the fixtures bundle which I can't resolve. I follow the steps as they are meant to be followed, adding the lines to the deps file, installing them, registering them in the autoload and appkernel.

When I try to run even only app/console, it breaks with:

Fatal error: Class 'Doctrine\Bundle\DoctrineBundle\Command\DoctrineCommand' not found in /var/www/.../bundles/Doctrine/Bundle/FixturesBundle/ Command/LoadDataFixturesDoctrineCommand.php on line 40

Which seems right because I don't have a DoctrineBundle directory under Doctrine\Bundle, only the DoctrineFixturesBundle. If I change that line to Symfony\Bundle\DoctrineBundle\... it works perfectly, because that class resides under that namespace actually.

Of course I can't leave it that way. I searched through the documentation, issues, everything, but it seems that noone has this same issue, so I must be missing some obvious point here.

Any ideas?

Thanks

Upvotes: 3

Views: 3964

Answers (1)

leek
leek

Reputation: 12121

Not long ago, all Doctrine bundles moved to the Doctrine organizaton. This causes some confusion based on which repository and branch you are using.

If you're using Symfony 2.0.x, then your deps should look something like this:

[DoctrineFixturesBundle]
    git=http://github.com/doctrine/DoctrineFixturesBundle.git
    target=bundles/Symfony/Bundle/DoctrineFixturesBundle
    version=origin/2.0

Notice the target/namespace is actually Symfony\Bundle\DoctrineFixturesBundle.


However, you shouldn't have any problems using the latest DoctrineFixturesBundle with Symfony 2.0.x - as long as you upgrade the rest of the Doctrine dependencies also. You can use this in your deps instead:

[doctrine-common]
    git=http://github.com/doctrine/common.git
    version=2.2.0

[doctrine-dbal]
    git=http://github.com/doctrine/dbal.git
    version=2.2.1

[doctrine]
    git=http://github.com/doctrine/doctrine2.git
    version=2.2.0

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

[DoctrineFixturesBundle]
    git=http://github.com/doctrine/DoctrineFixturesBundle.git
    target=bundles/Doctrine/Bundle/FixturesBundle

Upvotes: 5

Related Questions