I have this return symfony error with all my url website :
"ClassNotFoundException: Attempted to load class "DoctrineFixturesBundle" from namespace "Doctrine\Bundle\FixturesBundle" in C:\dev\Apache2.4.6\htdocs\MySite\app\AppKernel.php line 23. Do you need to "use" it from another namespace?"
This error appear when I modified the config.yml (part doctrine orm)for resolve others problem but it's not resolving. Indeed a back my change in this file and re-run my website but now nothing run correctly. I have this error anytime and anywhere.
I copy my code here but for response at simple question :
- do you have adding this line in AppKernel.php : $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(); ? RESPONSE : YES
- do you have install fixtures bundle ? RESPONSE : YES
- do you have install/update and self-update composer ? RESPONSE : YES
- do you have load fixtures in DB ? RESPONSE : YES (it run perfectly)
- do you have cleaning the cache ? RESPONSE : YES
All my fixtures engine run correctly just before this generate error.
AppKernel.php
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
composer.json
"require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.4",
"doctrine/orm": "2.4.2",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~3.0",
"sensio/generator-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0",
"doctrine/doctrine-fixtures-bundle": "dev-master"
},
config.yml
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver, add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
Thank for your precious help
very strange behaviour because it's solve automaticaly and alone. After lot of cache:clear, delete cache manually, comment/decomment line in AppKernel.php this issue solve.
But A new begin...
Now this is my dev toolbar symfony which don't run.
I think create a new topic for this new problem for don't mixing with this.
I'he got the same wierd error on
new Application\Extended\SonataMediaBundle\ExtendedSonataMediaBundle()
In my case it gone back to work after I fixed composer.json file and runned composer update. To be correct, first time I initiated "composer update" without composer.json fixes and error not disappeared, so "composer update" itself is not a solution, the key thing - is composer.json file fix.
This is even stranger because it was wrong fix - I removed slash in psr-0 autoload definition, so having:
"autoload": {
"psr-0": { "/": "src/" }
},
i got:
"autoload": {
"psr-0": { "": "src/" }
},
Thats only one slash! And it is wrong fix because composer suggest to not use empty namespace:
$ composer validate
./composer.json is valid, but with a few warnings
See https://getcomposer.org/doc/04-schema.md for details on the schema
Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance
Note 1: it worked with that slash in previous days and stoped to work today, pretty strange. Project were untouched in time between two working states!
Note 2: initial (in-box) state of composer.json file is without slash, I added it two weeks ago to suppress composer's dissatisfaction.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With