BUG Fix issue with inheritance of Injector service configuration #2946

Merged
merged 1 commit into from Sep 24, 2014

Conversation

Projects
None yet
3 participants
@tractorcow
Contributor

tractorcow commented Mar 12, 2014

This issue came up in a case where a parent class had a particular set of dependencies specified, and while direct subclasses of this would work fine with Injector, attempts to instantiate sub-subclasses of this would result in missing dependencies.

E.g. A extends B extends C, where only C has dependencies specified, and attempts to create an instance of A would break future calls to B::create().

The SilverStripeServiceConfigurationLocator would walk from A to C finding dependencies, and during this process "B" would be marked with a config of false, meaning future calls to B::create() (or sometimes A::create()) would incorrectly ignore all dependencies.

This fix no longer marks a class as having a false config unless its parent has a false config, or if there are no other parents above this.

SilverStripeServiceConfigurationLocator was also refactored to be a bit more test-case friendly and better documentation given.

This was a fun afternoon trying to debug...

@simonwelsh simonwelsh added the 3.1 label Mar 15, 2014

@tractorcow

This comment has been minimized.

Show comment Hide comment
@tractorcow

tractorcow Aug 12, 2014

Contributor

This still needs to be fixed. @hafriedlander would you like to look at this?

Contributor

tractorcow commented Aug 12, 2014

This still needs to be fixed. @hafriedlander would you like to look at this?

@tractorcow

This comment has been minimized.

Show comment Hide comment
@tractorcow

tractorcow Aug 24, 2014

Contributor

This has been rebased for merge.

Contributor

tractorcow commented Aug 24, 2014

This has been rebased for merge.

halkyon added a commit that referenced this pull request Sep 24, 2014

Merge pull request #2946 from tractorcow/pulls/3.1-fix-injector-inher…
…itance-bug

BUG Fix issue with inheritance of Injector service configuration

@halkyon halkyon merged commit 4ae0d90 into silverstripe:3.1 Sep 24, 2014

2 checks passed

ci/scrutinizer Scrutinizer: No new issues — Tests: passed
Details
continuous-integration/travis-ci The Travis CI build passed
Details

@tractorcow tractorcow deleted the tractorcow:pulls/3.1-fix-injector-inheritance-bug branch Sep 24, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment