BUGFIX Fixed places where Object::get_static() was being used. Replace

with Config system instead.
This commit is contained in:
Sean Harvey 2012-04-18 23:55:37 +12:00
parent 16e950cb6a
commit ccb941ea9d
3 changed files with 5 additions and 5 deletions

View File

@ -100,7 +100,7 @@ class DataExtensionTest extends SapphireTest {
* Test that DataObject::$api_access can be set to true via a extension
*/
function testApiAccessCanBeExtended() {
$this->assertTrue(Object::get_static('DataExtensionTest_Member', 'api_access'));
$this->assertTrue(Config::inst()->get('DataExtensionTest_Member', 'api_access', Config::FIRST_SET));
}
function testPermissionExtension() {

View File

@ -338,7 +338,7 @@ class SSViewer_DataPresenter extends SSViewer_Scope {
$exposedVariables = call_user_func(array($implementer, $variableMethod));
foreach($exposedVariables as $varName => $details) {
if (!is_array($details)) $details = array('method' => $details, 'casting' => Object::get_static('ViewableData', 'default_cast'));
if (!is_array($details)) $details = array('method' => $details, 'casting' => Config::inst()->get('ViewableData', 'default_cast', Config::FIRST_SET));
// If just a value (and not a key => value pair), use it for both key and value
if (is_numeric($varName)) $varName = $details['method'];
@ -405,7 +405,7 @@ class SSViewer_DataPresenter extends SSViewer_Scope {
// Get the object to cast as
$casting = isset($source['casting']) ? $source['casting'] : null;
// If not provided, use default
if (!$casting) $casting = Object::get_static('ViewableData', 'default_cast');
if (!$casting) $casting = Config::inst()->get('ViewableData', 'default_cast', Config::FIRST_SET);
$obj = new $casting($property);
$obj->setValue($res['value']);

View File

@ -275,7 +275,7 @@ class ViewableData extends Object implements IteratorAggregate {
$class = self::$default_cast;
}
return Object::get_static($class, 'escape_type');
return Config::inst()->get($class, 'escape_type', Config::FIRST_SET);
}
/**
@ -389,7 +389,7 @@ class ViewableData extends Object implements IteratorAggregate {
}
if(!is_object($value) && $forceReturnedObject) {
$default = Object::get_static('ViewableData', 'default_cast');
$default = Config::inst()->get('ViewableData', 'default_cast', Config::FIRST_SET);
$value = new $default($fieldName);
}