(on Tuesday, 23 November 2010, 02:00 PM -0800):
> Sorry to re-open a old thread but I wanted to know if I could use the
> MethodName as the index key for the return array?
<snip -- multicall example>
> How (If possible) can I get it to return something like this
>
> <code>
> Array
> (
> [0] => Array
> (
> [0] => system.listMethods
> [1] => system.methodHelp
> [2] => system.methodSignature
> [3] => system.multicall
> [4] => md5Value
> )
>
> [md5Value] => 0cff048a9159b57d3568e06ee6d5b454
> )
> </code>
>
> With the MethodName as the array index
It's not, as doing so would violate the XML-RPC multicall specification.
You could likely extend Zend_XmlRpc_Client to do that, but it won't be
something we do in the base library.
The approach you would take is to extend Zend_XmlRpc_Client, and modify
the call() method slightly. If I were to do it, I'd do something like
this:
public function call($method, $params = array())
{
$response = parent::call($method, $params);
if (!$method = 'system.multicall') {
return $response;
}
$newResponse = array();
foreach ($params as $index => $callParams) {
$newResponse[$callParams['methodName']] = $response[$index];
}
return $newResponse;
}
(Note: completely untested!)
--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
没有评论:
发表评论