Property | Type | Description | |
---|---|---|---|
$_entry | resource | Result entry identifier. | |
$_entry_cache | array | This currently is only used by {@link pop_entry()}. | |
$_errorCode | integer | Some errorcodes might be of interest that should not be considered errors, for example: - 4: LDAP_SIZELIMIT_EXCEEDED - indicates a huge search. Incomplete results are returned. If you just want to check if there is anything returned by the search at all, this could be catched. - 32: no such object - search here returns a count of 0. | |
$_iteratorCache | array | Cache for all entries already fetched from iterator interface. | |
$_ldap | Horde_Ldap | A reference of the Horde_Ldap object for passing to Horde_Ldap_Entry. | |
$_link | resource | LDAP resource link. | |
$_search | resource | Search result identifier. | |
$_searchedAttrs | array | This variable gets set from the constructor and can be retrieved through {@link searchedAttributes()}. |
Method | Description | |
---|---|---|
__construct ( resource $search, Horde_Ldap | resource $ldap, array $attributes = [] ) | Constructor. | |
__destruct ( ) | Destructor. | |
asArray ( ) : array | Returns entries as array. | |
count ( ) : integer | Returns the number of entries in the search result. | |
current ( ) : Horde_Ldap_Entry | false | SPL Iterator interface: Returns the current element. | |
entries ( ) : array | Returns all entries from the search result. | |
getErrorCode ( ) : integer | Returns the errorcode from the search. | |
key ( ) : string | false | SPL Iterator interface: Returns the identifying key (DN) of the current entry. | |
next ( ) | SPL Iterator interface: Moves forward to next entry. | |
popEntry ( ) : Horde_Ldap_Entry | false | Retrieve the next entry in the search result, but starting from last entry. | |
rewind ( ) | SPL Iterator interface: Rewinds the Iterator to the first element. | |
setLink ( resource $link ) | Sets the LDAP resource link. | |
setSearch ( resource $search ) | Sets the search objects resource link | |
shiftEntry ( ) : Horde_Ldap_Entry | false | Get the next entry from the search result. | |
sizeLimitExceeded ( ) : boolean | Returns wheter this search exceeded a sizelimit. | |
sorted ( array $attrs = ['cn'], integer $order = SORT_ASC ) : array | Returns entries sorted as objects. | |
sortedAsArray ( array $attrs = ['cn'], integer $order = SORT_ASC ) : array | Return entries sorted as array. | |
valid ( ) : boolean | SPL Iterator interface: Checks if there is a current element after calls to {@link rewind()} or {@link next()}. |
Method | Description | |
---|---|---|
searchedAttributes ( ) : array | Returns the attribute names this search selected. |
public __construct ( resource $search, Horde_Ldap | resource $ldap, array $attributes = [] ) | ||
$search | resource | Search result identifier. |
$ldap | Horde_Ldap | resource | Horde_Ldap object or a LDAP link resource |
$attributes | array | The searched attribute names, see {@link $_searchedAttrs}. |
array(
'cn=foo,dc=example,dc=com' => array(
'sn' => array('foo'),
'multival' => array('val1', 'val2', 'valN')),
'cn=bar,dc=example,dc=com' => array(
'sn' => array('bar'),
'multival' => array('val1', 'valN')))
foreach ($search as $dn => $entry) { ...
Of course, you may call {@link current()}, {@link key()}, {@link next()},
{@link rewind()} and {@link valid()} yourself.
If the search throwed an error, it returns false. False is also
returned, if the end is reached.
In case no call to next() was made, we will issue one, thus returning
the first entry. public current ( ) : Horde_Ldap_Entry | false | ||
return | Horde_Ldap_Entry | false |
public getErrorCode ( ) : integer | ||
return | integer | The LDAP error number. |
public next ( ) |
public popEntry ( ) : Horde_Ldap_Entry | false | ||
return | Horde_Ldap_Entry | false |
public rewind ( ) |
protected searchedAttributes ( ) : array | ||
return | array |
public setLink ( resource $link ) | ||
$link | resource | LDAP link identifier. |
public setSearch ( resource $search ) | ||
$search | resource | Search result identifier. |
public shiftEntry ( ) : Horde_Ldap_Entry | false | ||
return | Horde_Ldap_Entry | false | Reference to Horde_Ldap_Entry object or false if no more entries exist. |
public sizeLimitExceeded ( ) : boolean | ||
return | boolean | True if the size limit was exceeded. |
To sort entries first by location, then by surname, but descending:
$entries = $search->sorted(array('locality', 'sn'), SORT_DESC);
To sort entries first by location, then by surname, but descending:
$entries = $search->sortedAsArray(array('locality', 'sn'), SORT_DESC);
protected array $_entry_cache | ||
return | array |
protected int $_errorCode | ||
return | integer |
protected array $_iteratorCache | ||
return | array |
protected Horde_Ldap $_ldap | ||
return | Horde_Ldap |
protected resource $_search | ||
return | resource |
protected array $_searchedAttrs | ||
return | array |