Hack to fix Fatal error: Call to undefined method stdClass::allMethodNames() (merged from 2.0.2 branch, r42505)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@42921 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2007-10-02 04:52:31 +00:00
parent bd81e2a2be
commit 70db5d36a0

View File

@ -200,9 +200,12 @@ class Object {
protected function addMethodsFrom($parameterName, $arrayIndex = null) { protected function addMethodsFrom($parameterName, $arrayIndex = null) {
$obj = isset($arrayIndex) ? $this->{$parameterName}[$arrayIndex] : $this->$parameterName; $obj = isset($arrayIndex) ? $this->{$parameterName}[$arrayIndex] : $this->$parameterName;
if(!$obj) user_error("Object::addMethodsFrom: $parameterName/$arrayIndex", E_USER_ERROR); if(!$obj) user_error("Object::addMethodsFrom: $parameterName/$arrayIndex", E_USER_ERROR);
$methodNames = $obj->allMethodNames(true); // Hack to fix Fatal error: Call to undefined method stdClass::allMethodNames()
foreach($methodNames as $methodName) { if(method_exists($obj, 'allMethodNames')) {
Object::$extraMethods[$this->class][$methodName] = array("parameterName" => $parameterName, "arrayIndex" => $arrayIndex); $methodNames = $obj->allMethodNames(true);
foreach($methodNames as $methodName) {
Object::$extraMethods[$this->class][$methodName] = array("parameterName" => $parameterName, "arrayIndex" => $arrayIndex);
}
} }
} }