Topic: Registering Single Class Method 0.5

Hello,

before i did upgrade to 0.5 stable the following worked:

$xajax->registerFunction(array('doAddChar', $this->controllerModel,'addChar'));

After upgrading to 0.5 stable the old one does not work anymore:

$xajax->register(XAJAX_FUNCTION,'doAddChar',array('doAddChar', $this->controllerModel,'addChar'));

Getting:

Catchable fatal error: Object of class CreatecharModel could not be converted to string in ... plugin_layer/support/xajaxUserFunction.inc.php on line 196

Anyone know whats the problem? smile

thx!

sc0pe

Last edited by sc0pe (2009-06-09 9:59:36 AM)

Re: Registering Single Class Method 0.5

Hello scOpe,

You have two options with the new function registration:

Code: PHP

$xajax->register(XAJAX_FUNCTION, 'methodName', array('optionName' => 'optionValue'));

 

or

Code: PHP

$myFunction = new xajaxUserFunction('methodName', 'pathAndFileToInclude.inc.php', array('optionName' => 'optionValue'));

$xajax->register(XAJAX_FUNCTION, $myFunction, array('anotherOptionName' => 'anotherOptionValue');

 

and you can always substitute the array:
array('alias', $myObject, 'methodName')
where 'methodName' appears in the above examples

So, give the following a try:

Code: PHP

$xajax->register(XAJAX_FUNCTION, array('doAddChar', $this->controllerModel, 'addChar'));

 

Let me know how it goes. big_smile

// Joe

xajax Developer
Connect to me on LinkedIn:
http://www.linkedin.com/in/calledtoconstruct

Re: Registering Single Class Method 0.5

Hi CtC,

Code: PHP

$xajax->register(XAJAX_FUNCTION, array('doAddChar', $this->controllerModel, 'addChar'));

 

just did what i wanted wink

thx!