4

I try to install an existing Symfony 2.0 project, and so i run rm -rf vendor, and bin/vendor install. He can't find DoctrineFixturesBundle, so i update my deps file and i put :

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

I run again rm -rf vendor/* and bin/vendor install, and i get this error :

The autoloader expected class "Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesBundle" to be defined in file "/home/me/developpement/myproject/app/../vendor/bundles/Symfony/Bundle/DoctrineFixturesBundle/DoctrineFixturesBundle.php". The file was found but the class was not in it, the class name or namespace probably has a typo.

So, in my AppKernel.php i replace :

new Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesBundle(),

with :

new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),

because the DoctrineFixturesBundle.php file namespace is Doctrine\Bundle\FixturesBundle.

And now, i get this error :

Fatal error: Class 'Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle' not found in /home/me/developpement/myproject/app/AppKernel.php on line 21

What should i do to make it work ?

Edited to add:

This is my autoload.php :

$loader->registerNamespaces(array(
    'Symfony'          => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'),
    'Sensio'           => __DIR__.'/../vendor/bundles',
    'JMS'              => __DIR__.'/../vendor/bundles',
    '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',
    'Gedmo'            => __DIR__.'/../vendor/gedmo-doctrine-extensions/lib',
    'Doctrine\\Common\\DataFixtures' => __DIR__.'/../vendor/doctrine-fixtures/lib',
    'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib',
    'Doctrine\\DBAL\\Migrations' => __DIR__.'/../vendor/doctrine-migrations/lib',
    'Doctrine\\DBAL'   => __DIR__.'/../vendor/doctrine-dbal/lib',
    'Knp\Component'    => __DIR__.'/../vendor/knp-components/src',
    'Knp\Bundle'       => __DIR__.'/../vendor/bundles',
 ));
1
  • I have the same setup as you and the DoctrineFixturesBundle.php has the namespace Symfony\Bundle\DoctrineFixturesBundle. It looks as though somehow you are downloading the master version instead of the 2.0 version... are you sure your deps file is just like this? Can you post the whole deps file? Commented Aug 28, 2012 at 15:41

2 Answers 2

2

Did you check your autoload.php? This is where you tell Symfony which Namespace is located in a specific directory.

Sign up to request clarification or add additional context in comments.

Comments

0

The namespace is probably not auto loaded. Check this vendor\composer\autoload_namespaces.php file and make sure it contains the following code.

'Doctrine\\Bundle\\FixturesBundle' => array($vendorDir . '/doctrine/doctrine-fixtures-bundle'),

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.