Hi there,
I’m trying to extend the oxconfig class via an Oxid Module. Things work fine, except when adding static methods.
What I’m trying to achieve with this module is basically having the reverse of the checkSpecialChars & checkParamSpecialChars methods.
Am I doing something wrong, or this is not achievable via the Oxid extend?
Thanks in advance!
Extracts from the relevant code:
metadata.php
'extend' => array(
'oxconfig' => 'my_module/my_class_oxconfig',
),
my_class_oxconfig.php
class my_class_oxconfig extends my_class_oxconfig_parent{
// calls to this method fail
public static function checkSpecialChars_decode( $sValue, $aRaw = null )
{
return oxRegistry::getConfig()->checkParamSpecialChars_decode( $sValue, $aRaw );
}
// calls to this method work as expected
public function checkParamSpecialChars_decode( $sValue, $aRaw = null )
{
return 'decoded value';
}
}
my_controller.php
$sMessage = oxConfig::getParameter( 'c_message' );
// works fine
$sMessage = oxRegistry::getConfig()->checkParamSpecialChars_decode( $sMessage );
// fails with PHP Fatal error:
// Call to undefined method oxConfig::checkSpecialChars_decode() in my_controller.php
$sMessage = oxConfig::checkSpecialChars_decode( $sMessage );