-
Notifications
You must be signed in to change notification settings - Fork 821
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
FIX Singleton creation #5151
FIX Singleton creation #5151
Conversation
Ensure DataObject instances are aware they are singletons so functions like populateDefaults() can be skipped. (fixes silverstripe#4878)
@tractorcow one of the builds failed during setup, I'm guessing re-running test won't help here? |
Hm, the logic looks sound... but maybe @chillu should look over this too. Perhaps in 4.x we should override Object::singleton() in DataObject, in order to inject the new parameter, using the 3rd argument to @chillu is this specific fix ok for 3.x? |
Don't worry about that; It's the fault of imagick no longer supporting php 5.3 |
That might work but some refactoring would be required first. BTW the manipulation I'm doing of constructor args could probably be done in |
Yeah, that's why I hate global functions. Itcan use $class::singleton() fine though.;) |
So the question is then, is there a reason we need a global singleton method? Unless we can remove it (or effectively remove it by passing through calls to Let's give it a try... #5154 (I've really got to get tests working locally) |
Not anymore, really, at least not in 4.0. Injector::inst()->get() should be used for non-object subclasses, and anything that extends Object (or trait Injectable in master) should just use ::singleton(). |
Closing this for now pending outcome of #5154 |
New version at #7850 |
Ensure DataObject instances are aware they are singletons so functions like populateDefaults() can be skipped. (fixes #4878)