Property | Type | Description | |
---|---|---|---|
$_attributes | array | Attributes. | |
$_changes | array | Map with changes to the entry. | |
$_delete | boolean | Shall the entry be deleted? | |
$_dn | string | Distinguished name of the entry. | |
$_entry | resource | Entry resource identifier. | |
$_ldap | Horde_Ldap | This object will be used for updating and schema checking. | |
$_link | resource | LDAP resource identifier. | |
$_map | array | Map of attribute names. | |
$_new | boolean | Is this a new entry? | |
$_newdn | string | New distinguished name. | |
$_original | array | Original attributes before any modification. |
Method | Description | |
---|---|---|
add ( array $attr = [] ) | Adds new attributes or a new values to existing attributes. | |
attributes ( ) : array | Returns an array of attributes names. | |
createConnected ( Horde_Ldap $ldap, resource $entry ) : Horde_Ldap_Entry | Creates an entry object out of an LDAP entry resource. | |
createExisting ( string $dn, array $attrs = [] ) : Horde_Ldap_Entry | Creates an entry object that is considered to exist already. | |
createFresh ( string $dn, array $attrs = [] ) : Horde_Ldap_Entry | Creates a fresh entry that may be added to the directory later. | |
currentDN ( ) : string | Returns always the original DN. | |
delete ( string | array $attr = null ) | Deletes an attribute, a value or the whole entry. | |
dn ( string $dn = null ) : string | Returns or sets the distinguished name of the entry. | |
exists ( string $attr ) : boolean | Returns whether an attribute exists or not. | |
getChanges ( ) : array | Returns the attribute changes to be carried out once update() is called. | |
getLDAP ( ) : Horde_Ldap | Returns a reference to the LDAP-Object of this entry. | |
getValue ( string $attr, string $option = null ) : string | array | Returns the value of a specific attribute. | |
getValues ( ) : array | Returns the values of all attributes in a hash. | |
isNew ( ) : boolean | Returns whether the entry is considered new (not present in the server). | |
markAsNew ( boolean $mark = true ) | Marks the entry as new or existing. | |
pregMatch ( string $regex, string $attr_name, array &$matches = [] ) : boolean | Applies a regular expression onto a single- or multi-valued attribute (like preg_match()). | |
replace ( array $attr = [], boolean $force = false ) | Replaces attributes or their values. | |
setLDAP ( Horde_Ldap $ldap ) | Sets a reference to the LDAP object of this entry. | |
update ( ) | Updates the entry on the directory server. | |
willBeDeleted ( ) : boolean | Is this entry going to be deleted once update() is called? | |
willBeMoved ( ) : boolean | Is this entry going to be moved once update() is called? |
Method | Description | |
---|---|---|
__construct ( Horde_Ldap | resource | array $ldap, string | resource $entry = null ) | Constructor. | |
_getAttrName ( string $attr ) : string | Returns the right attribute name. | |
_loadAttributes ( array $attributes = null ) | Sets the internal attributes array. |
protected __construct ( Horde_Ldap | resource | array $ldap, string | resource $entry = null ) | ||
$ldap | Horde_Ldap | resource | array | Horde_Ldap object, LDAP connection resource or array of attributes. |
$entry | string | resource | Either a DN or a LDAP entry resource. |
protected _getAttrName ( string $attr ) : string | ||
$attr | string | Name of attribute. |
return | string | The right name of the attribute |
protected _loadAttributes ( array $attributes = null ) | ||
$attributes | array | Attributes to set for this entry. |
array('attributename' => 'single value',
'attributename' => array('value1', 'value2'))
When the attribute already exists the values will be added, otherwise
the attribute will be created. These changes are local to the entry and
do not affect the entry on the server until update() is called.
You can add values of attributes that you haven't originally selected,
but if you do so, {@link getValue()} and {@link getValues()} will only
return the values you added, *NOT* all values present on the server. To
avoid this, just refetch the entry after calling {@link update()} or
select the attribute. public attributes ( ) : array | ||
return | array | Array of attribute names. |
public static createConnected ( Horde_Ldap $ldap, resource $entry ) : Horde_Ldap_Entry | ||
$ldap | Horde_Ldap | Horde_Ldap object. |
$entry | resource | PHP LDAP entry resource. |
return | Horde_Ldap_Entry |
$attrs = array('attribute1' => array('value1', 'value2'),
'attribute2' => 'single value');
public static createExisting ( string $dn, array $attrs = [] ) : Horde_Ldap_Entry | ||
$dn | string | DN of the entry. |
$attrs | array | Attributes of the entry. |
return | Horde_Ldap_Entry |
$attrs = array('attribute1' => array('value1', 'value2'),
'attribute2' => 'single value');
public static createFresh ( string $dn, array $attrs = [] ) : Horde_Ldap_Entry | ||
$dn | string | DN of the entry. |
$attrs | array | Attributes of the entry. |
return | Horde_Ldap_Entry |
public getChanges ( ) : array | ||
return | array | The due changes. |
public getLDAP ( ) : Horde_Ldap | ||
return | Horde_Ldap | Reference to the Horde_Ldap object (the connection). |
array('attributename' => 'single value',
'attributename' => array('value1', value2', value3'))
$matches = array(
0 => array (usual preg_match() returned array),
1 => array (usual preg_match() returned array)
)
$matches will always be initialized to an empty array inside.
Usage example:
try {
if ($entry->pregMatch('/089(\d+)/', 'telephoneNumber', $matches)) {
Match of value 1, content of first bracket
echo 'First match: ' . $matches[0][1];
} else {
echo 'No match found.';
}
} catch (Horde_Ldap_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
array('attributename' => 'single value',
'attribute2name' => array('value1', 'value2'),
'deleteme1' => null,
'deleteme2' => '')
If the attribute does not yet exist it will be added instead (see also
$force). If the attribue value is null, the attribute will de deleted.
These changes are local to the entry and do not affect the entry on the
server until {@link update()} is called.
In some cases you are not allowed to read the attributes value (for
example the ActiveDirectory attribute unicodePwd) but are allowed to
replace the value. In this case replace() would assume that the
attribute is not in the directory yet and tries to add it which will
result in an LDAP_TYPE_OR_VALUE_EXISTS error. To force replace mode
instead of add, you can set $force to true. public setLDAP ( Horde_Ldap $ldap ) | ||
$ldap | Horde_Ldap | Horde_Ldap object that this entry should be connected to. |
public update ( ) |
public willBeDeleted ( ) : boolean | ||
return | boolean | True if this entry is going to be deleted. |
public willBeMoved ( ) : boolean | ||
return | boolean | True if this entry is going to be move. |
protected Horde_Ldap $_ldap | ||
return | Horde_Ldap |
protected array $_original | ||
return | array |