mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR fix call to undefined method when a virtual page picks up the wrong object.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@97875 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
a6a1b619fc
commit
c982bbc5df
@ -316,7 +316,7 @@ class VirtualPage_Controller extends Page_Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Also check the original objects' original controller for the method
|
* Also check the original object's original controller for the method
|
||||||
*
|
*
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @return bool
|
* @return bool
|
||||||
@ -347,7 +347,11 @@ class VirtualPage_Controller extends Page_Controller {
|
|||||||
// if the exception isn't a 'no method' error, rethrow it
|
// if the exception isn't a 'no method' error, rethrow it
|
||||||
if ($e->getCode() !== 2175) throw $e;
|
if ($e->getCode() !== 2175) throw $e;
|
||||||
$original = $this->copyContentFrom();
|
$original = $this->copyContentFrom();
|
||||||
return call_user_func_array(array($original, $method), $args);
|
$originalClass = get_class($original);
|
||||||
|
if ($originalClass == 'SiteTree') $name = 'ContentController';
|
||||||
|
else $name = $originalClass."_Controller";
|
||||||
|
$controller = new $name($this->dataRecord->copyContentFrom());
|
||||||
|
return call_user_func_array(array($controller, $method), $args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user