[dev] Turba API searchClients()

Jan Schneider jan at horde.org
Mon Sep 26 07:19:50 UTC 2011


Zitat von Luis Felipe Marzagao <lfbm.andamentos at gmail.com>:

> Hello:
>
> I just noticed that:
>
> $registry->contacts->searchClients(array(null));
>
> or
>
> $registry->contacts->searchClients(array(''));
>
> Returns a nested array with *all* clients, with this kind of array set:
>
> Array
> (
>     [] => Array
>         (
>             [0] => Array
>                 (
>                     [__key] => ....
>                     ...
>                     [name] => John Doe
>                     ....
>                 )
>             [1] => Array
>                 (
>                     [__key] => ....
>                     ...
>                     [name] => Jane Smith
>                     ....
>                 )
>             ...
>     )
> )
>
> The key of the first array is empty "[]", as this was supposed to  
> hold the filter search criteria, which, in this example, was not  
> supplied with the searchClients method.

It was supplied. If you didn't supply it you would have called the  
method with array().

> So:
>
> 1 - Is this the recommended way of retrieving all clients of  
> returning all clients or is it just an accident?

Yes, that's how it supposed to work.

> 2 - If it is the recommended way, shouldn´t the first key be set to  
> something like 'all-clients', instead of an empty key, just to make  
> it easier to read or easier to manipulate?

No.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the dev mailing list