-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ResolveBindingsPass: Don't throw error for unused service, missing parent class #27088
Conversation
This mirrors what was already done in AutowirePass
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
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/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
Is there any solution out there? |
@jeroendesloovere looks totally unrelated... If you found a bug, please open a separate issue. |
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
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.yaml
services:
# ignore datafixtures in production environment,
# because it usages DoctrineFixturesBundle classes which are only loaded in for "dev" and "test" environments
BabyGuesser\DataFixtures\:
resource: '../src/DataFixtures/*'
autowire: false
autoconfigure: false
public: false
|
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,
ResolveBindingsPass
will 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,
Fixtures
base class) is not installed, causing a build error, even though these service classes are unused.Cheers!