On Wed, Mar 10, 2010 at 9:54 AM, Bruno Fajardo <bsfaja...@gmail.com> wrote:
[snip]
> 2010/3/10 Auke van Slooten <a...@muze.nl>:
>> This is not what I meant. I should perhaps mention that it's an xml-rpc
>> client and the method calls are remote method calls. The multiCall method
>> gathers multiple method calls into a single request.
>>
>> The trick I'm using now is to set a private property in the $client->__get()
>> method when the property you're accessing is 'system'. From then untill you
>> call the method 'multiCall', instead of calling the methods (in this case
>> methodOne and methodTwo) the client creates a new object with the call
>> information (method name and arguments) and returns that. In multiCall all
>> arguments are therefor call information objects and multicall creates a
>> single request based on that information.
>
> Hmm, you cleared that to me now... If you need to first create the
> property "system" and then call a method in that object "system",
> can't you do something like:
>
> $client->system = null;
> $client->system->multiCall(
>    $client->methodOne(),
>    $client->methodTwo()
> );
>
> I'm not testing these snippets of code, so sorry if I'm getting something 
> wrong.
>
> Cheers,
> Bruno.
>
[snip]

I'm not sure you would want to assign null to $client->system. After
all, __set() might not be defined.

I agree with Rob here. If order is really crucial, then call the
statements in the correct order:

<?php

/**
 * causes $client to call __get() in order to resolve
 * 'system'
 */
$system = $client->system;


/**
 * You should add some handling here to make sure that
 * $system is really an object that implements your
 * multiCall() method, and not something else (like null).
 */


$system->multiCall(
    $client->methodOne(),
    $client->methodTwo()
);

?>



Andrew

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to