Commit Graph

94 Commits

Author SHA1 Message Date
Ingo Schommer
e2f073f38a Method visibility according to coding conventions 2012-09-20 10:46:59 +02:00
Sam Minnée
93cdb83ac8 Merge pull request #738 from simonwelsh/lsb-53-30
FIX Removes version checking for LSB in Object::static_lookup()
2012-08-27 21:07:29 -07:00
Simon Welsh
e159a68f89 FIX Removes version checking for LSB in Object::static_lookup()
Late static binding was added in PHP 5.3, not 5.4. As such, the check for 5.4
and then fallback to Reflection isn't needed.
2012-08-23 17:51:29 +12:00
Hamish Friedlander
fa37c448a5 API Reverse config extra statics control flow
Config system used to provide an add_static_source method, which was intended for
use by Extensions to add statics. But extensions for a class arent initialised
until at least one instance of that class is created, so before that the
Config system didnt include values from extensions

This patch reverses the control flow, so that the Config system explictly asks
each Object for its additional config sources via the new method
get_extra_config_sources. This method returns an array that can contain
string names of classes and also raw associative arrays.

The developer visible change is that Extension#add_to_class has been
deprecated. Instead there is a new method, get_extra_config, which has
the same method signature but needs to guarantee that it doesnt
cause side effects. Additionally there is no need to call
parent::get_extra_config - this is handled automatically.
2012-08-23 09:29:13 +12:00
Ingo Schommer
712f28bc78 Scoped deprecation messages (fixes #7645) 2012-07-13 11:37:35 +02:00
Sam Minnee
114ebb6953 API CHANGE: Don't have any instance caching in singleton(), rely on Injector for this. 2012-06-11 22:41:12 +12:00
Marcus Nyeholt
ae7fc6f4d2 RECOMMIT This is a recommit of a previously merged, but reverted, commit. The initial commit had problems when running "tests/all flush=all" when dev/build would re-analyse a bunch of stuff; fixes to address this went into https://github.com/silverstripe/sapphire/pull/487, but for some reason the actual base changes didn't, so I'm re-submitting them in a separate pull.
BUGFIX Versioned's constructor doesn't provide suitable defaults. Previously a bug/feature in singleton, where it would pass null,true as params to strong_create, which would then get passed through as params to Versioned's constructor, meant that the code still executed fine (as was set to something that wasn't an array, so the null and true were instead taken as args). The fact that the usage of singleton(Versioned) never really used the classes code, purely for value lookup, meant that this never propagated errors. I've now switched singleton() to use the injector for retrieving values, which means these dud values are no longer passed through

CHANGE Given that Config::inst is an implementation of the singleton pattern itself, I've removed the extra call to singleton(). A side effect of this is that it gets around a possibly nasty circular reference with the dependency injector (which relies on the config object); in future, this dependency structure should really be structured from the DI directly.

MINOR Change singleton and strong_create to use dependency injector
2012-06-03 20:41:00 +10:00
Sean Harvey
c3eabffcb9 MINOR Use shorthand {class}::get() syntax instead of DataList::create()
in core code.
2012-05-28 21:13:42 +12:00
Sean Harvey
29e04a1049 Revert "BUGFIX Versioned's constructor doesn't provide suitable defaults. Previously a bug/feature in singleton, where it would pass null,true as params to strong_create, which would then get passed through as params to Versioned's constructor, meant that the code still executed fine (as was set to something that wasn't an array, so the null and true were instead taken as args). The fact that the usage of singleton(Versioned) never really used the classes code, purely for value lookup, meant that this never propagated errors. I've now switched singleton() to use the injector for retrieving values, which means these dud values are no longer passed through"
This reverts commit 5eaca340b4.
2012-05-23 09:52:57 +12:00
Marcus Nyeholt
5eaca340b4 BUGFIX Versioned's constructor doesn't provide suitable defaults. Previously a bug/feature in singleton, where it would pass null,true as params to strong_create, which would then get passed through as params to Versioned's constructor, meant that the code still executed fine (as was set to something that wasn't an array, so the null and true were instead taken as args). The fact that the usage of singleton(Versioned) never really used the classes code, purely for value lookup, meant that this never propagated errors. I've now switched singleton() to use the injector for retrieving values, which means these dud values are no longer passed through
CHANGE Given that Config::inst is an implementation of the singleton pattern itself, I've removed the extra call to singleton(). A side effect of this is that it gets around a possibly nasty circular reference with the dependency injector (which relies on the config object); in future, this dependency structure should really be structured from the DI directly.

MINOR Change singleton and strong_create to use dependency injector
2012-05-22 19:09:35 +10:00
Marcus Nyeholt
b269badfbe FEATURE: Added dependency injector for managing creation of new objects and their dependencies.
API CHANGE: Pass Object::create() calls to Injector::create().
API CHANGE: Add "RequestProcessor" injection point in Director, that Director will call preRequest() and postRequest() on.
2012-05-18 12:39:57 +12:00
Sean Harvey
5702007da1 MINOR Fixing comment to be more concise. 2012-05-04 11:11:36 +12:00
Ingo Schommer
20a837947f MINOR Using PHP version constants rather than version_compare() in Object::static_lookup(), since its called 10k times on an average CMS load that makes a difference of about 3% (with APC) 2012-05-04 00:26:09 +02:00
Sean Harvey
4c6be2931b BUGFIX Removing use of deprecated Object static functions like
get_static(), set_static(), uninherited() etc. Replace with equivalent
Config system get(), update()
2012-04-18 23:10:57 +12:00
Simon Welsh
f07258f3cf MINOR Update @package values to match renaming sapphire 2012-04-15 10:50:19 +12:00
Simon Welsh
3a6341a251 API-CHANGE sapphire folder can now be renamed. 2012-04-15 10:50:19 +12:00
Sean Harvey
4c1aba8542 BUGFIX Object::get_extensions() is now declared as static, as it was
never an instance method
2012-04-12 12:02:13 +12:00
Ingo Schommer
40d73127ae MINOR Using late static binding instead of Object::create() calls 2012-04-04 17:10:31 +02:00
Andrew O'Neil
de2832e65f ENHANCEMENT: Allow Object::create() to be called with late static binding.
This allows DataList::create('SiteTree') as equivalent to Object::create('DataList', 'SiteTree'), without
having to have a create() function on DataList. Required for E_STRICT compliance.
2012-03-27 17:57:42 +13:00
Sean Harvey
f63497d6f9 ENHANCEMENT Extension arguments are now passed through to add_to_class()
static function on Extension classes.
BUGFIX FulltextSearchable didn't pass through arguments, use now
available $args parameter with FulltextSearchable::add_to_class()
2012-03-12 16:14:47 +13:00
Hamish Friedlander
05cf5a833b MINOR: Dump deprecation notices introduced by the config system to 3.1.0 as it breaks heaps of code 2012-03-09 18:16:45 +13:00
Hamish Friedlander
876f4c5299 API CHANGE: Modify extensions system to support new config system. Statics are now declared directly on extensions, and there is an add_to_class method extensions can hook into to modify class configuration 2012-03-09 18:16:44 +13:00
Hamish Friedlander
0ab171d7c0 API CHANGE: Add config property on Object as shortcut to objects own properties 2012-03-09 18:13:57 +13:00
Hamish Friedlander
1b05a337b8 API CHANGE: Strip out old static accessors from Object 2012-03-09 18:13:56 +13:00
Hamish Friedlander
d355cd5baf ENHANCEMENT: Add config layer - the Config access class itself, and the ConfigManfiest builder which parses in the yaml config files 2012-03-09 18:13:56 +13:00
Sam Minnee
adbcf61c56 MINOR: Minor fixes after new SS_List interfaces cleanup 2012-03-09 17:50:32 +13:00
Sam Minnee
da64123116 MINOR: Removed use of deprecated ClassInfo::is_subclass_of 2011-10-29 17:34:32 +13:00
Sam Minnee
e5afa25522 MINOR: Use Deprecation class to indicate deprecated methods in core. 2011-10-29 17:34:31 +13:00
Stig Lindqvist
3a11bb2f66 MINOR Do not call a constructor if there aren't one.
This will fix a lot of unittests failing.
2011-10-27 18:13:41 +02:00
Fred Condo
9bd499617b Spelling correction
Found and fixed all misspellings of "[Hh]ierarchy"
2011-10-18 15:32:52 -07:00
Sam Minnee
0601384cda BUGFIX: Reapply decorator statics if it has been removed and re-added. (merged from r100706) 2011-10-07 14:12:50 +02:00
Ingo Schommer
ea9faeccf7 API CHANGE Removed Object->cacheToFileWithArgs(), please use Object->cacheToFile() with the $arguments param 2011-05-01 20:23:07 +12:00
ajshort
3a1c2df4e7 API CHANGE: Renamed DataObjectDecorator to DataExtension.
API CHANGE: Renamed LeftAndMainDecorator to LeftAndMainExtension.
MINOR: Replaced all references to decorators with extension.
2011-04-26 11:01:38 +10:00
Simon Welsh
44dabbb865 Landing pull request 3. BUGFIX: Object::__call() checking the wrong static. Fixes #6438 2011-04-25 23:11:09 +12:00
ajshort
969aa0b51e MINOR: Replaced deprecated ClassInfo::is_subclass_of() calls. 2011-03-24 20:14:41 +11:00
Will Rossiter
0b54ce3450 ENHANCEMENT: #5248 improved the handling of attaching invalid extensions to dataobjects.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@115174 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-12-19 23:04:44 +00:00
Sean Harvey
a5f5617ab2 API CHANGE Removed deprecated method Object::extInstance(), please use Object::getExtensionInstance() instead
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@115056 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-12-15 04:30:00 +00:00
Sean Harvey
744791219e MINOR #6256 Removed PHP version < 5.1.3 functionality workaround from Object::create() and Object::strong_create()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@115055 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-12-15 04:27:43 +00:00
Sam Minnee
890ac94a6a MINOR: Several changes merged from branches/2.4
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112060 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-13 01:35:19 +00:00
Sam Minnee
3db905bc42 BUGFIX: Update Object::parse_class_spec() to handle arrays. (from r101105)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@111587 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-04 04:47:08 +00:00
Sam Minnee
310272bc7e BUGFIX: call_user_func_array changed to PHP 5.1 compatible notation (from r101099)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@111586 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-04 04:46:55 +00:00
Sam Minnee
cc355a4f18 API CHANGE: Replaced eval based creation of extension and field objects with Object::create_from_string().
API CHANGE: Introduced new function Object::create_from_string() to instantiate an object from a string like 'Int(50)' (from r101093)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@111585 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-04 04:46:41 +00:00
Sam Minnee
ec067ab08a API CHANGE: Pass the full extension string as the 2nd argument to DataObjectDecorator::extraStatics() (from r101043)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@111568 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-04 04:32:30 +00:00
Ingo Schommer
7e8a2c10c9 MINOR Changed places of Object::extInstance() to Object::getExtensionInstance() and added a notice if extInstance is used in future (from r100487)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@105575 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-05-25 03:55:30 +00:00
Ingo Schommer
69543bb575 BUGFIX #4929: Fixed Object::add_static_vars() for uninherited static.s (from r97586)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102510 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-04-12 22:00:25 +00:00
Ingo Schommer
007b309e62 BUGFIX: Reset the methods applied to classes after adding/removing extensions. (from r89957) (from r96726)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102348 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-04-12 01:50:38 +00:00
Andrew Short
d4acf7c938 MINOR: Removed unnecessary extension instance check in Object->__construct(), since Extensions no longer inherit from Object.
From: Andrew Short <andrewjshort@gmail.com>

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@88772 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-13 01:44:21 +00:00
Sam Minnee
d8113a667e API CHANGE: Extension no longer inherits from Object.
ENHANCEMENT: Object::__construct() performance improved slightly.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84160 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-08-11 08:35:14 +00:00
Sam Minnee
81eeef25e8 ENHANCEMENT: Improved performance of Object::uninherited_static()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84159 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-08-11 06:44:47 +00:00
Sam Minnee
70dc433d38 ENHANCEMENT: Improved performance of Object::allMethodNames() and Object::addMethodsFrom()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84158 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-08-11 06:13:33 +00:00