Hello!
We got a error message when we tried to install ecommerce 0.6 width Silverstripe version 2.3.3 in object.php, line 405. We had to comment out this lines, then it worked good. But we worrie about that commenting out this lines could cause an other error someplace in the system. The code looks like this (we commented out the last lines):
/**
* Add an extension to a specific class.
* As an alternative, extensions can be added to a specific class
* directly in the {@link Object::$extensions} array.
* See {@link SiteTree::$extensions} for examples.
* Keep in mind that the extension will only be applied to new
* instances, not existing ones (including all instances created through {@link singleton()}).
*
* @param string $class Class that should be decorated - has to be a subclass of {@link Object}
* @param string $extension Subclass of {@link Extension} with optional parameters
* as a string, e.g. "Versioned" or "Translatable('Param')"
*/
public static function add_extension($class, $extension) {
if(!preg_match('/^([^(]*)/', $extension, $matches)) {
return false;
}
$extensionClass = $matches[1];
if(!class_exists($extensionClass)) {
user_error(sprintf('Object::add_extension() - Can\'t find extension class for "%s"', $extensionClass), E_USER_ERROR);
}
if(!is_subclass_of($extensionClass, 'Extension')) {
user_error(sprintf('Object::add_extension() - Extension "%s" is not a subclass of Extension', $extensionClass), E_USER_ERROR);
}
// unset some caches
self::$cached_statics[$class]['extensions'] = null;
$subclasses = ClassInfo::subclassesFor($class);
$subclasses[] = $class;
if($subclasses) foreach($subclasses as $subclass) {
unset(self::$classes_constructed[$subclass]);
}
// merge with existing static vars
self::add_static_var($class, 'extensions', array($extension));
// load statics now for DataObject classes
//if(is_subclass_of($class, 'DataObject')) {
//DataObjectDecorator::load_extra_statics($class, $extensionClass);
//}
}
Has anyone had this problem, and is it a better way to solve it? Any suggestions?
Have a nice day from Norway!