Zend\Ldap\Node includes the magic property accessors __set(), __get(), __unset() and __isset() to access the attributes by their name. They proxy to Zend\Ldap\Node::setAttribute(), Zend\Ldap\Node::getAttribute(), Zend\Ldap\Node::deleteAttribute() and Zend\Ldap\Node::existsAttribute() respectively. Furthermore the class implements ArrayAccess for array-style-access to the attributes. Zend\Ldap\Node also implements Iterator and RecursiveIterator to allow for recursive tree-traversal.
Method | Description |
---|---|
Zend\Ldap\Ldap getLdap() | Returns the current LDAP connection. Throws Zend\Ldap\Exception\LdapException if current node is in detached mode (not connected to a Zend\Ldap\Ldap instance). |
Zend\Ldap\Node attachLdap(Zend\Ldap\Ldap $ldap) | Attach the current node to the $ldapZend\Ldap\Ldap instance. Throws Zend\Ldap\Exception\LdapException if $ldap is not responsible for the current node (node is not a child of the $ldap base DN). |
Zend\Ldap\Node detachLdap() | Detach node from LDAP connection. |
boolean isAttached() | Checks if the current node is attached to a LDAP connection. |
Zend\Ldap\Node create(string|array|Zend\Ldap\Dn $dn, array $objectClass) | Factory method to create a new detached Zend\Ldap\Node for a given DN. Creates a new Zend\Ldap\Node with the DN $dn and the object-classes $objectClass. |
Zend\Ldap\Node fromLdap(string|array|Zend\Ldap\Dn $dn, Zend\Ldap\Ldap $ldap) | Factory method to create an attached Zend\Ldap\Node for a given DN. Loads an existing Zend\Ldap\Node with the DN $dn from the LDAP connection $ldap. |
Zend\Ldap\Node fromArray((array $data, boolean $fromDataSource) | Factory method to create a detached Zend\Ldap\Node from array data $data. if $fromDataSource is TRUE (FALSE by default), the data is treated as being present in a LDAP tree. |
boolean isNew() | Tells if the node is considered as new (not present on the server). Please note, that this doesn’t tell if the node is really present on the server. Use Zend\Ldap\Node::exists() to see if a node is already there. |
boolean willBeDeleted() | Tells if this node is going to be deleted once Zend\Ldap\Node::update() is called. |
Zend\Ldap\Node delete() | Marks this node as to be deleted. Node will be deleted on calling Zend\Ldap\Node::update() if Zend\Ldap\Node::willBeDeleted() is TRUE. |
boolean willBeMoved() | Tells if this node is going to be moved once Zend\Ldap\Node::update() is called. |
Zend\Ldap\Node update(Zend\Ldap\Ldap $ldap) | Sends all pending changes to the LDAP server. If $ldap is omitted the current LDAP connection is used. If the current node is detached from a LDAP connection a Zend\Ldap\Exception\LdapException will be thrown. If $ldap is provided the current node will be attached to the given LDAP connection. |
Zend\Ldap\Dn getCurrentDn() | Gets the current DN of the current node as a Zend\Ldap\Dn. This does not reflect possible rename-operations. |
Zend\Ldap\Dn getDn() | Gets the original DN of the current node as a Zend\Ldap\Dn. This reflects possible rename-operations. |
string getDnString(string $caseFold) | Gets the original DN of the current node as a string. This reflects possible rename-operations. |
array getDnArray(string $caseFold) | Gets the original DN of the current node as an array. This reflects possible rename-operations. |
string getRdnString(string $caseFold) | Gets the RDN of the current node as a string. This reflects possible rename-operations. |
array getRdnArray(string $caseFold) | Gets the RDN of the current node as an array. This reflects possible rename-operations. |
Zend\Ldap\Node setDn(Zend\Ldap\Dn|string|array $newDn) | Sets the new DN for this node effectively moving the node once Zend\Ldap\Node::update() is called. |
Zend\Ldap\Node move(Zend\Ldap\Dn|string|array $newDn) | This is an alias for Zend\Ldap\Node::setDn(). |
Zend\Ldap\Node rename(Zend\Ldap\Dn|string|array $newDn) | This is an alias for Zend\Ldap\Node::setDn(). |
array getObjectClass() | Returns the objectClass of the node. |
Zend\Ldap\Node setObjectClass(array|string $value) | Sets the objectClass attribute. |
Zend\Ldap\Node appendObjectClass(array|string $value) | Appends to the objectClass attribute. |
string toLdif(array $options) | Returns a LDIF representation of the current node. $options will be passed to the Zend\Ldap\Ldif\Encoder. |
array getChangedData() | Gets changed node data. The array contains all changed attributes. This format can be used in Zend\Ldap\Ldap::add() and Zend\Ldap\Ldap::update(). |
array getChanges() | Returns all changes made. |
string toString() | Returns the DN of the current node - proxies to Zend\Ldap\Dn::getDnString(). |
string __toString() | Casts to string representation - proxies to Zend\Ldap\Dn::toString(). |
array toArray(boolean $includeSystemAttributes) | Returns an array representation of the current node. If $includeSystemAttributes is FALSE (defaults to TRUE) the system specific attributes are stripped from the array. Unlike Zend\Ldap\Node::getAttributes() the resulting array contains the DN with key ‘dn’. |
string toJson(boolean $includeSystemAttributes) | Returns a JSON representation of the current node using Zend\Ldap\Node::toArray(). |
array getData(boolean $includeSystemAttributes) | Returns the node’s attributes. The array contains all attributes in its internal format (no conversion). |
boolean existsAttribute(string $name, boolean $emptyExists) | Checks whether a given attribute exists. If $emptyExists is FALSE empty attributes (containing only array()) are treated as non-existent returning FALSE. If $emptyExists is TRUE empty attributes are treated as existent returning TRUE. In this case the method returns FALSE only if the attribute name is missing in the key-collection. |
boolean attributeHasValue(string $name, mixed|array $value) | Checks if the given value(s) exist in the attribute. The method returns TRUE only if all values in $value are present in the attribute. Comparison is done strictly (respecting the data type). |
integer count() | Returns the number of attributes in the node. Implements Countable. |
mixed getAttribute(string $name, integer|null $index) | Gets a LDAP attribute. Data conversion is applied using Zend\Ldap\Attribute::getAttribute(). |
array getAttributes(boolean $includeSystemAttributes) | Gets all attributes of node. If $includeSystemAttributes is FALSE (defaults to TRUE) the system specific attributes are stripped from the array. |
Zend\Ldap\Node setAttribute(string $name, mixed $value) | Sets a LDAP attribute. Data conversion is applied using Zend\Ldap\Attribute::setAttribute(). |
Zend\Ldap\Node appendToAttribute(string $name, mixed $value) | Appends to a LDAP attribute. Data conversion is applied using Zend\Ldap\Attribute::setAttribute(). |
array|integer getDateTimeAttribute(string $name, integer|null $index) | Gets a LDAP date/time attribute. Data conversion is applied using Zend\Ldap\Attribute::getDateTimeAttribute(). |
Zend\Ldap\Node setDateTimeAttribute(string $name, integer|array $value, boolean $utc) | Sets a LDAP date/time attribute. Data conversion is applied using Zend\Ldap\Attribute::setDateTimeAttribute(). |
Zend\Ldap\Node appendToDateTimeAttribute(string $name, integer|array $value, boolean $utc) | Appends to a LDAP date/time attribute. Data conversion is applied using Zend\Ldap\Attribute::setDateTimeAttribute(). |
Zend\Ldap\Node setPasswordAttribute(string $password, string $hashType, string $attribName) | Sets a LDAP password on $attribName (defaults to ‘userPassword’) to $password with the hash type $hashType (defaults to Zend\Ldap\Attribute::PASSWORD_HASH_MD5). |
Zend\Ldap\Node deleteAttribute(string $name) | Deletes a LDAP attribute. |
void removeDuplicatesFromAttribute(string$name) | Removes duplicate values from a LDAP attribute. |
void removeFromAttribute(string $attribName, mixed|array $value) | Removes the given values from a LDAP attribute. |
boolean exists(Zend\Ldap\Ldap $ldap) | Checks if the current node exists on the given LDAP server (current server is used if NULL is passed). |
Zend\Ldap\Node reload(Zend\Ldap\Ldap $ldap) | Reloads the current node’s attributes from the given LDAP server (current server is used if NULL is passed). |
Zend\Ldap\Node\Collection searchSubtree(string|Zend\Ldap\Filter\AbstractFilter $filter, integer $scope, string $sort) | Searches the nodes’s subtree with the given $filter and the given search parameters. See Zend\Ldap\Ldap::search() for details on the parameters $scope and $sort. |
integer countSubtree(string|Zend\Ldap\Filter\AbstractFilter $filter, integer $scope) | Count the nodes’s subtree items matching the given $filter and the given search scope. See Zend\Ldap\Ldap::search() for details on the $scope parameter. |
integer countChildren() | Count the nodes’s children. |
Zend\Ldap\Node\Collection searchChildren(string|Zend\Ldap\Filter\AbstractFilter $filter, string $sort) | Searches the nodes’s children matching the given $filter. See Zend\Ldap\Ldap::search() for details on the $sort parameter. |
boolean hasChildren() | Returns whether the current node has children. |
Zend\Ldap\Node\ChildrenIterator getChildren() | Returns all children of the current node. |
Zend\Ldap\Node getParent(Zend\Ldap\Ldap $ldap) | Returns the parent of the current node using the LDAP connection $ldap (uses the current LDAP connection if omitted). |
The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.