-
-
Notifications
You must be signed in to change notification settings - Fork 195
How to handle composer dev bundles in non-dev environments? #346
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
Comments
Are you accidentally running your application in the |
This error was observed when deploying with deployer. I'm pretty sure it's running in |
@xabbuh Any ideas. It's not just this bundle. I have
All of which are required as dev composer dependencies. |
Resolved in: symfony/maker-bundle#151 |
but not resolved for me :/ export APP_ENV=prod
./composer.phar install --no-dev
bundles.php return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Nelmio\ApiDocBundle\NelmioApiDocBundle::class => ['all' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
]; composer.json {
"type": "project",
"license": "MIT",
"require": {
"php": "^7.1.3",
"ext-iconv": "*",
"ext-apcu": "*",
"ext-gd": "*",
"ext-pdo_sqlite": "*",
"symfony/orm-pack": "*",
"symfony/console": "^4.0",
"symfony/flex": "^1.0",
"symfony/framework-bundle": "^4.0",
"symfony/lts": "^4@dev",
"symfony/monolog-bundle": "^3.2",
"symfony/serializer-pack": "*",
"symfony/yaml": "^4.0",
"symfony/dotenv": "^4.0",
"symfony/validator": "^4.0",
"nelmio/api-doc-bundle": "^3.2@dev",
"imagine/imagine": "^0.7@dev"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.0",
"symfony/var-dumper": "^4.0",
"symfony/maker-bundle": "^1.4"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"id": "01C0P3TPAW6JF5P0QRKQ1T7WZE",
"allow-contrib": false
}
}
} |
… missing parent class (weaverryan) This PR was merged into the 3.4 branch. Discussion ---------- ResolveBindingsPass: Don't throw error for unused service, missing parent class | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no-> | Tests pass? | yes | Fixed tickets | symfony/flex#346 (comment) | License | MIT | Doc PR | n/a Hey guys! In short: if you: A) auto-register a class as a service B) That class's parent class is missing C) ... but this class/service is unused Currently, `ResolveBindingsPass` will fail and throw an exception. The change avoids that - only throwing the exception if the service IS used. This is already done in `AutowirePass`. The real issue is DoctrineFixturesBundle, where, on production, the bundle (and so, `Fixtures` base class) is not installed, causing a build error, even though these service classes are unused. Cheers! Commits ------- 309da92 Avoiding an error when an unused service has a missing base class
I'm having the same problem when trying to deploy to Heroku (which uses "prod" environment"). My setup
This is the error when trying to deploy using
And my composer.json contains
Solutions, anybody?It could be solved by moving => Does anybody know another solution? |
Yes: update your |
@jeroendesloovere hmm. Indeed, if you look at the error, it looks like it's happening because the When you install
... but, for some reason, the |
Heroku works with env vars, so you need to run |
Some more information: I believe cache:clear is not the problem@weaverryan and @Pierstoval
Local clearing of the cache gives no problems as you can see in the screenshots below. src/DataFixtures using DoctrineFixturesBundle classes
I have
=> But DoctrineFixturesBundle is not enabled for production environment in Possible solution?Ignore autowiring on DataFixtures if in production environment? |
I have tried some things and found the solution. Using |
@inverse, @Gemorroj, @jeroendesloovere |
Still getting the same issue for this with deployer:
I can't figure out where cache:clear is getting the dev env from. In deployer the env is correctly set to prod. For now i've added debug and the web profiler to "normal" requirements(not dev) but it's weird to have this on a production environnement. |
@ChoppyThing did you set the app env to production for deploy? For me I hooked in this before deploy/rollback
|
@inverse I did. I'll try this tomorrow, thanks. |
|
Same problem. bundles.php file is not updated when deploying to prod. |
bundles.php file content will be like this, Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], here If you have If the module is missing here, then add it and set the environment accordingly. Refer Symfony Doc for bundles |
I am trying to migrate an existing Symfony 4 application to flex and use the DoctrineMigrationBundle for both dev/test environments which is installed as a dev dependency.
which all looks good in my bundles.php:
The problem comes when booting:
Since this is a dev dependency this is stripped out when deploying to production. What's advised in this situation? Aside including it as a normal dependency.
The text was updated successfully, but these errors were encountered: