Skip to content

Commit

Permalink
BUGFIX Fixed places where Object::get_static() was being used. Replace
Browse files Browse the repository at this point in the history
with Config system instead.
  • Loading branch information
halkyon committed Apr 18, 2012
1 parent 16e950c commit ccb941e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/model/DataExtensionTest.php
Expand Up @@ -100,7 +100,7 @@ function testAddExtensionLoadsStatics() {
* 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() {
Expand Down
4 changes: 2 additions & 2 deletions view/SSViewer.php
Expand Up @@ -338,7 +338,7 @@ protected function createCallableArray(&$extraArray, $interfaceToQuery, $variabl
$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'];
Expand Down Expand Up @@ -405,7 +405,7 @@ function getInjectedValue($property, $params, $cast = true) {
// 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']);
Expand Down
4 changes: 2 additions & 2 deletions view/ViewableData.php
Expand Up @@ -275,7 +275,7 @@ public function escapeTypeForField($field) {
$class = self::$default_cast;
}

return Object::get_static($class, 'escape_type');
return Config::inst()->get($class, 'escape_type', Config::FIRST_SET);
}

/**
Expand Down Expand Up @@ -389,7 +389,7 @@ public function obj($fieldName, $arguments = null, $forceReturnedObject = true,
}

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);
}

Expand Down

0 comments on commit ccb941e

Please sign in to comment.