mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Reapply decorator statics if it has been removed and re-added. (merged from r100706)
This commit is contained in:
parent
8302af1ea8
commit
0601384cda
@ -596,6 +596,16 @@ abstract class Object {
|
||||
* @param string $extension Classname of an {@link Extension} subclass, without parameters
|
||||
*/
|
||||
public static function remove_extension($class, $extension) {
|
||||
// unload statics now for DataObject classes
|
||||
if(ClassInfo::is_subclass_of($class, 'DataObject')) {
|
||||
if(!preg_match('/^([^(]*)/', $extension, $matches)) {
|
||||
user_error("Bad extension '$extension'", E_USER_WARNING);
|
||||
} else {
|
||||
$extensionClass = $matches[1];
|
||||
DataObjectDecorator::unload_extra_statics($class, $extensionClass);
|
||||
}
|
||||
}
|
||||
|
||||
if(self::has_extension($class, $extension)) {
|
||||
self::set_static(
|
||||
$class,
|
||||
|
@ -89,6 +89,10 @@ abstract class DataExtension extends Extension {
|
||||
}
|
||||
}
|
||||
|
||||
public static function unload_extra_statics($class, $extension) {
|
||||
self::$extra_statics_loaded[$class][$extension] = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit the given query object to support queries for this extension
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user