mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Deprecate ViewableData magic caching logic
This commit is contained in:
parent
be60219ffc
commit
6847b0080f
@ -177,13 +177,32 @@ class ViewableData extends Object implements IteratorAggregate {
|
|||||||
foreach($this->allMethodNames() as $method) {
|
foreach($this->allMethodNames() as $method) {
|
||||||
if($method[0] == '_' && $method[1] != '_') {
|
if($method[0] == '_' && $method[1] != '_') {
|
||||||
$this->createMethod(
|
$this->createMethod(
|
||||||
substr($method, 1), "return \$obj->cachedCall('$method', \$args, '" . substr($method, 1) . "');"
|
substr($method, 1),
|
||||||
|
"return \$obj->deprecatedCachedCall('$method', \$args, '" . substr($method, 1) . "');"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::defineMethods();
|
parent::defineMethods();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to facilitate deprecation of underscore-prefixed methods automatically being cached.
|
||||||
|
*
|
||||||
|
* @param string $field
|
||||||
|
* @param array $arguments
|
||||||
|
* @param string $identifier an optional custom cache identifier
|
||||||
|
* @return unknown
|
||||||
|
*/
|
||||||
|
public function deprecatedCachedCall($method, $args = null, $identifier = null) {
|
||||||
|
Deprecation::notice(
|
||||||
|
'4.0',
|
||||||
|
'You are calling an underscore-prefixed method (e.g. _mymethod()) without the underscore. This behaviour,
|
||||||
|
and the caching logic behind it, has been deprecated.',
|
||||||
|
Deprecation::SCOPE_GLOBAL
|
||||||
|
);
|
||||||
|
return $this->cachedCall($method, $args, $identifier);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Merge some arbitrary data in with this object. This method returns a {@link ViewableData_Customised} instance
|
* Merge some arbitrary data in with this object. This method returns a {@link ViewableData_Customised} instance
|
||||||
|
Loading…
Reference in New Issue
Block a user