Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
ResolveBindingsPass: Don't throw error for unused service, missing parent class#27088
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This mirrors what was already done in AutowirePass
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Good catch
nicolas-grekas commentedApr 30, 2018
Thank you@weaverryan. |
… 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/aHey guys!In short: if you:A) auto-register a class as a serviceB) That class's parent class is missingC) ... but this class/service is unusedCurrently, `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
jeroendesloovere commentedJul 4, 2018
Is there any solution out there? |
nicolas-grekas commentedJul 4, 2018
@jeroendesloovere looks totally unrelated... If you found a bug, please open a separate issue. |
jeroendesloovere commentedJul 4, 2018
Are you sure? So when I try to deploy to Heroku (which uses |
| $calls[] =array($constructor,$value->getArguments()); | ||
| } | ||
| }catch (RuntimeException$e) { | ||
| $this->container->getDefinition($this->currentId)->addError($e->getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
should be$value->addError(), no ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
this could be an inline definition, but we want the main definition to hold the error
jeroendesloovere commentedJul 6, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
SolutionUsing
Wrong "require":{// ...},"require-dev":{// ..."doctrine/doctrine-fixtures-bundle":"^3.0",}, Correct "require":{// ..."doctrine/doctrine-fixtures-bundle":"^3.0",},"require-dev":{// ...}, Other things I tried but failed# services.yamlservices:# ignore datafixtures in production environment,# because it usages DoctrineFixturesBundle classes which are only loaded in for "dev" and "test" environmentsBabyGuesser\DataFixtures\:resource:'../src/DataFixtures/*'autowire:falseautoconfigure:falsepublic:false
|
maximejosien commentedMar 4, 2019
Hello guys, I had the same error with the DoctrineFixtureBundle, to fix this problem, I added this in my service.yaml The DateFixtures directory is exclude and I don't have any more this error using prod with this bundle in my composer-dev. I hope it will help someone. |
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,
ResolveBindingsPasswill fail and throw an exception. The change avoids that - only throwing the exception if the service IS used. This is already done inAutowirePass.The real issue is DoctrineFixturesBundle, where, on production, the bundle (and so,
Fixturesbase class) is not installed, causing a build error, even though these service classes are unused.Cheers!