New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class not found error with composer no-dev #225
Comments
I figured it out myself. Here is what if have done:
services:
# This part is important!
_defaults:
autowire: true
autoconfigure: true
public: false
# Use the namespace where your fixtures are
AppBundle\Development\DataFixtures\:
resource: '../../src/AppBundle/Development/DataFixtures'
services:
AppBundle\:
exclude: '../../src/AppBundle/{Entity,Repository,Tests,Development}' After these changes you can have this bundle as a dev dependency and run |
Thanks for posting your fix! There must be a nicer way to handle this. |
In general, if you only require this bundle as part of your dev dependencies, you should only create the appropriate services if the bundle is present. In this case, the service is generated due to the default config (which creates a service for every class it finds). What confuses me is that the services are private and removed from the cached container if not used (which they shouldn't be in this case), so the service shouldn't be instantiated. Could you maybe get a trace for the original error or figure out what causes a fixture service to be instantiated? |
Ah, I just got more info about this error. @alcaeus you're understanding is correct. However, the error comes earlier: when I think affects any project using DoctrineFixturesBundle as a dev dependency and deploying with |
@weaverryan Thanks for investigating! Solving this in the container makes sense! |
This issue came back on Symfony 4 with flex. |
It's an issue in Symfony - nothing we can do here. Please report it there. |
I installed this bundle as recommended as a composer dev dependency. For my production deployment I do a
composer install --optimize-autoloader --no-dev
and this bundle gets removed.composer
also excutecache:clear --no-warmup
afterwards and during that command I get this error:The container try to autowire the fixtures but I use my fixtures only during development.
It's a minor issue but does anybody know how I can get rid of it?
The text was updated successfully, but these errors were encountered: