Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Zend_Ldap_Node provides an object oriented view into a LDAP node.

\Zend_Ldap
$_ldap= ''
Holds the connection to the LDAP server if in connected mode.

__construct(
\Zend_Ldap_Dn $dn, array $data, boolean $fromDataSource, \Zend_Ldap $ldap
=
null
)
:
void
Constructor.
Constructor is protected to enforce the use of factory methods.
Name | Type | Description |
---|---|---|
$dn | \Zend_Ldap_Dn | |
$data | array | |
$fromDataSource | boolean | |
$ldap | \Zend_Ldap |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

__get(
string $name
)
:
array
Gets a LDAP attribute.
Inherited from: \Zend_Ldap_Node_Abstract::__get()This is an offline method.
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
array |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

__isset(
string $name
)
:
boolean
Checks whether a given attribute exists.
Inherited from: \Zend_Ldap_Node_Abstract::__isset()Empty attributes will be treated as non-existent.
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
boolean |

__set(
string $name, mixed $value
)
:
null
Sets a LDAP attribute.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string | |
$value | mixed |
Type | Description |
---|---|
null |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

__sleep(
)
:
array
Serialization callback
Only DN and attributes will be serialized.
Type | Description |
---|---|
array |

__toString(
)
:
string
Cast to string representation {@see toString()}
Inherited from: \Zend_Ldap_Node_Abstract::__toString()Type | Description |
---|---|
string |

__unset(
string $name
)
:
null
Deletes a LDAP attribute.
This method deletes the attribute.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
null |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

_assertChangeableAttribute(
string $name
)
:
boolean
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

_ensureRdnAttributeValues(
boolean $overwrite
=
false
)
:
void
Ensures that teh RDN attributes are correctly set.
Name | Type | Description |
---|---|---|
$overwrite | boolean | True to overwrite the RDN attributes |

_getDn(
)
:
\Zend_Ldap_Dn
Gets the DN of the current node as a Zend_Ldap_Dn.
This is an offline method.
Type | Description |
---|---|
\Zend_Ldap_Dn |

_loadData(
array $data, boolean $fromDataSource
)
:
void
Name | Type | Description |
---|---|---|
$data | array | |
$fromDataSource | boolean |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

_markAsNew(
boolean $new
)
:
void
Marks this node as new.
Node will be added (instead of updated) on calling update() if $new is true.
Name | Type | Description |
---|---|---|
$new | boolean |

_markAsToBeDeleted(
boolean $delete
)
:
void
Marks this node as to be deleted.
Node will be deleted on calling update() if $delete is true.
Name | Type | Description |
---|---|---|
$delete | boolean |

_setAttribute(
string $name, mixed $value, boolean $append
)
:
void
Checks if the attribute can be set and sets it accordingly.
Name | Type | Description |
---|---|---|
$name | string | |
$value | mixed | |
$append | boolean |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

_setDateTimeAttribute(
string $name, integer|array $value, boolean $utc, boolean $append
)
:
void
Checks if the attribute can be set and sets it accordingly.
Name | Type | Description |
---|---|---|
$name | string | |
$value | integer|array | |
$utc | boolean | |
$append | boolean |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

appendObjectClass(
array|string $value
)
:
\Zend_Ldap_Node
Appends to the objectClass.
This is an offline method.
Name | Type | Description |
---|---|---|
$value | array|string |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

appendToAttribute(
string $name, mixed $value
)
:
\Zend_Ldap_Node
Appends to a LDAP attribute.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string | |
$value | mixed |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

appendToDateTimeAttribute(
string $name, integer|array $value, boolean $utc
=
false
)
:
\Zend_Ldap_Node
Appends to a LDAP date/time attribute.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string | |
$value | integer|array | |
$utc | boolean |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

attachLdap(
\Zend_Ldap $ldap
)
:
\Zend_Ldap_Node
Attach node to an LDAP connection
This is an offline method.
Name | Type | Description |
---|---|---|
$ldap | \Zend_Ldap |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

attributeHasValue(
string $attribName, mixed|array $value
)
:
boolean
Checks if the given value(s) exist in the attribute
Inherited from: \Zend_Ldap_Node_Abstract::attributeHasValue()Name | Type | Description |
---|---|---|
$attribName | string | |
$value | mixed|array |
Type | Description |
---|---|
boolean |

count(
)
:
int
Returns the number of attributes in node.
Inherited from: \Zend_Ldap_Node_Abstract::count()Implements Countable
Type | Description |
---|---|
int |

countChildren(
)
:
integer
Count children of current node.
This is an online method.
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

countSubtree(
string|\Zend_Ldap_Filter_Abstract $filter, integer $scope
=
Zend_Ldap
)
:
integer
Count items in current subtree found by given filter.
This is an online method.
Name | Type | Description |
---|---|---|
$filter | string|\Zend_Ldap_Filter_Abstract | |
$scope | integer |
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

create(
string|array|\Zend_Ldap_Dn $dn, array $objectClass
=
array
)
:
\Zend_Ldap_Node
Factory method to create a new detached Zend_Ldap_Node for a given DN.
Name | Type | Description |
---|---|---|
$dn | string|array|\Zend_Ldap_Dn | |
$objectClass | array |
Type | Description |
---|---|
\Zend_Ldap_Node |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

delete(
)
:
\Zend_Ldap_Node
Marks this node as to be deleted
Node will be deleted on calling update() if $delete is true.
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |

deleteAttribute(
string $name
)
:
\Zend_Ldap_Node
Deletes a LDAP attribute.
This method deletes the attribute.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

detachLdap(
)
:
\Zend_Ldap_Node
Detach node from LDAP connection
This is an offline method.
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |

exists(
\Zend_Ldap $ldap
=
null
)
:
boolean
Check if node exists on LDAP.
This is an online method.
Name | Type | Description |
---|---|---|
$ldap | \Zend_Ldap |
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

existsAttribute(
string $name, boolean $emptyExists
=
false
)
:
boolean
Checks whether a given attribute exists.
Inherited from: \Zend_Ldap_Node_Abstract::existsAttribute()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 method returns false only if the attribute name is missing in the key-collection.
Name | Type | Description |
---|---|---|
$name | string | |
$emptyExists | boolean |
Type | Description |
---|---|
boolean |

fromArray(
array $data, boolean $fromDataSource
=
false
)
:
\Zend_Ldap_Node
Factory method to create a detached Zend_Ldap_Node from array data.
Name | Type | Description |
---|---|---|
$data | array | |
$fromDataSource | boolean |
Type | Description |
---|---|
\Zend_Ldap_Node |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

fromLdap(
string|array|\Zend_Ldap_Dn $dn, \Zend_Ldap $ldap
)
:
\Zend_Ldap_Node|null
Factory method to create an attached Zend_Ldap_Node for a given DN.
Name | Type | Description |
---|---|---|
$dn | string|array|\Zend_Ldap_Dn | |
$ldap | \Zend_Ldap |
Type | Description |
---|---|
\Zend_Ldap_Nodenull |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

getAttribute(
string $name, integer $index
=
null
)
:
mixed
Gets a LDAP attribute.
Inherited from: \Zend_Ldap_Node_Abstract::getAttribute()This is an offline method.
Name | Type | Description |
---|---|---|
$name | string | |
$index | integer |
Type | Description |
---|---|
mixed |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

getAttributes(
boolean $includeSystemAttributes
=
true
)
:
array
Gets all attributes of node.
Inherited from: \Zend_Ldap_Node_Abstract::getAttributes()The collection contains all attributes.
This is an offline method.
Name | Type | Description |
---|---|---|
$includeSystemAttributes | boolean |
Type | Description |
---|---|
array |

getChangedData(
)
:
array
Gets changed node data.
The array contains all changed attributes. This format can be used in {@link Zend_Ldap::add()} and {@link Zend_Ldap::update()}.
This is an offline method.
Type | Description |
---|---|
array |

getChanges(
)
:
array
Returns all changes made.
This is an offline method.
Type | Description |
---|---|
array |

getChildren(
)
:
\Zend_Ldap_Node_ChildrenIterator
Returns the children for the current node.
Can be used offline but returns an empty array if children have not been retrieved yet.
Type | Description |
---|---|
\Zend_Ldap_Node_ChildrenIterator |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

getCurrentDn(
)
:
\Zend_Ldap_Dn
Gets the current DN of the current node as a Zend_Ldap_Dn.
The method returns a clone of the node's DN to prohibit modification.
This is an offline method.
Type | Description |
---|---|
\Zend_Ldap_Dn |

getData(
boolean $includeSystemAttributes
=
true
)
:
array
Gets node attributes.
Inherited from: \Zend_Ldap_Node_Abstract::getData()The array contains all attributes in its internal format (no conversion).
This is an offline method.
Name | Type | Description |
---|---|---|
$includeSystemAttributes | boolean |
Type | Description |
---|---|
array |

getDateTimeAttribute(
string $name, integer $index
=
null
)
:
array|integer
Gets a LDAP date/time attribute.
Inherited from: \Zend_Ldap_Node_Abstract::getDateTimeAttribute()This is an offline method.
Name | Type | Description |
---|---|---|
$name | string | |
$index | integer |
Type | Description |
---|---|
arrayinteger |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

getDn(
)
:
\Zend_Ldap_Dn
Gets the DN of the current node as a Zend_Ldap_Dn.
Inherited from: \Zend_Ldap_Node_Abstract::getDn()The method returns a clone of the node's DN to prohibit modification.
This is an offline method.
Type | Description |
---|---|
\Zend_Ldap_Dn |

getDnArray(
string $caseFold
=
null
)
:
array
Gets the DN of the current node as an array.
Inherited from: \Zend_Ldap_Node_Abstract::getDnArray()This is an offline method.
Name | Type | Description |
---|---|---|
$caseFold | string |
Type | Description |
---|---|
array |

getDnString(
string $caseFold
=
null
)
:
string
Gets the DN of the current node as a string.
Inherited from: \Zend_Ldap_Node_Abstract::getDnString()This is an offline method.
Name | Type | Description |
---|---|---|
$caseFold | string |
Type | Description |
---|---|
string |

getObjectClass(
)
:
array
Gets the objectClass of the node
Inherited from: \Zend_Ldap_Node_Abstract::getObjectClass()Type | Description |
---|---|
array |

getParent(
\Zend_Ldap $ldap
=
null
)
:
\Zend_Ldap_Node
Returns the parent of the current node.
Name | Type | Description |
---|---|---|
$ldap | \Zend_Ldap |
Type | Description |
---|---|
\Zend_Ldap_Node |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

getRdnArray(
string $caseFold
=
null
)
:
array
Gets the RDN of the current node as an array.
Inherited from: \Zend_Ldap_Node_Abstract::getRdnArray()This is an offline method.
Name | Type | Description |
---|---|---|
$caseFold | string |
Type | Description |
---|---|
array |

getRdnString(
string $caseFold
=
null
)
:
string
Gets the RDN of the current node as a string.
Inherited from: \Zend_Ldap_Node_Abstract::getRdnString()This is an offline method.
Name | Type | Description |
---|---|---|
$caseFold | string |
Type | Description |
---|---|
string |

hasChildren(
)
:
boolean
Checks if current node has children.
Returns whether the current element has children.
Can be used offline but returns false if children have not been retrieved yet.
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

isAttached(
)
:
boolean
Checks if the current node is attached to a LDAP server.
This is an offline method.
Type | Description |
---|---|
boolean |

isNew(
)
:
boolean
Tells if the node is consiedered as new (not present on the server)
Please note, that this doesn't tell you if the node is present on the server. Use {@link exits()} to see if a node is already there.
Type | Description |
---|---|
boolean |

move(
\Zend_Ldap_Dn|string|array $newDn
)
:
\Zend_Ldap_Node
{@see setDn()}
This is an offline method.
Name | Type | Description |
---|---|---|
$newDn | \Zend_Ldap_Dn|string|array |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

offsetExists(
string $name
)
:
boolean
Checks whether a given attribute exists.
Inherited from: \Zend_Ldap_Node_Abstract::offsetExists()Implements ArrayAccess.
Empty attributes will be treated as non-existent.
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
boolean |

offsetGet(
string $name
)
:
array
Gets a LDAP attribute.
Inherited from: \Zend_Ldap_Node_Abstract::offsetGet()Implements ArrayAccess.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
array |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

offsetSet(
string $name, mixed $value
)
:
null
Sets a LDAP attribute.
Implements ArrayAccess.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string | |
$value | mixed |
Type | Description |
---|---|
null |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

offsetUnset(
string $name
)
:
null
Deletes a LDAP attribute.
Implements ArrayAccess.
This method deletes the attribute.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
null |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

reload(
\Zend_Ldap $ldap
=
null
)
:
\Zend_Ldap_Node
Reload node attributes from LDAP.
This is an online method.
Name | Type | Description |
---|---|---|
$ldap | \Zend_Ldap |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

removeDuplicatesFromAttribute(
string $attribName
)
:
void
Removes duplicate values from a LDAP attribute
Name | Type | Description |
---|---|---|
$attribName | string |

removeFromAttribute(
string $attribName, mixed|array $value
)
:
void
Remove given values from a LDAP attribute
Name | Type | Description |
---|---|---|
$attribName | string | |
$value | mixed|array |

rename(
\Zend_Ldap_Dn|string|array $newDn
)
:
\Zend_Ldap_Node
{@see setDn()}
This is an offline method.
Name | Type | Description |
---|---|---|
$newDn | \Zend_Ldap_Dn|string|array |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

searchChildren(
string|\Zend_Ldap_Filter_Abstract $filter, string $sort
=
null
)
:
\Zend_Ldap_Node_Collection
Gets children of current node.
This is an online method.
Name | Type | Description |
---|---|---|
$filter | string|\Zend_Ldap_Filter_Abstract | |
$sort | string |
Type | Description |
---|---|
\Zend_Ldap_Node_Collection |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

searchSubtree(
string|\Zend_Ldap_Filter_Abstract $filter, integer $scope
=
Zend_Ldap, string $sort
=
null
)
:
\Zend_Ldap_Node_Collection
Search current subtree with given options.
This is an online method.
Name | Type | Description |
---|---|---|
$filter | string|\Zend_Ldap_Filter_Abstract | |
$scope | integer | |
$sort | string |
Type | Description |
---|---|
\Zend_Ldap_Node_Collection |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

setAttribute(
string $name, mixed $value
)
:
\Zend_Ldap_Node
Sets a LDAP attribute.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string | |
$value | mixed |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

setDateTimeAttribute(
string $name, integer|array $value, boolean $utc
=
false
)
:
\Zend_Ldap_Node
Sets a LDAP date/time attribute.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string | |
$value | integer|array | |
$utc | boolean |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

setDn(
\Zend_Ldap_Dn|string|array $newDn
)
:
\Zend_Ldap_Node
Sets the new DN for this node
This is an offline method.
Name | Type | Description |
---|---|---|
$newDn | \Zend_Ldap_Dn|string|array |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

setObjectClass(
array|string $value
)
:
\Zend_Ldap_Node
Sets the objectClass.
This is an offline method.
Name | Type | Description |
---|---|---|
$value | array|string |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

setPasswordAttribute(
string $password, string $hashType
=
Zend_Ldap_Attribute, string $attribName
=
userPassword
)
:
\Zend_Ldap_Node
Sets a LDAP password.
Name | Type | Description |
---|---|---|
$password | string | |
$hashType | string | |
$attribName | string |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

toArray(
boolean $includeSystemAttributes
=
true
)
:
array
Returns an array representation of the current node
Inherited from: \Zend_Ldap_Node_Abstract::toArray()Name | Type | Description |
---|---|---|
$includeSystemAttributes | boolean |
Type | Description |
---|---|
array |

toJson(
boolean $includeSystemAttributes
=
true
)
:
string
Returns a JSON representation of the current node
Inherited from: \Zend_Ldap_Node_Abstract::toJson()Name | Type | Description |
---|---|---|
$includeSystemAttributes | boolean |
Type | Description |
---|---|
string |

toLdif(
array $options
=
array
)
:
string
Returns a LDIF representation of the current node
Name | Type | Description |
---|---|---|
$options | array | Additional options used during encoding |
Type | Description |
---|---|
string |

toString(
)
:
string
Returns the DN of the current node. {@see getDnString()}
Inherited from: \Zend_Ldap_Node_Abstract::toString()Type | Description |
---|---|
string |

update(
\Zend_Ldap $ldap
=
null
)
:
\Zend_Ldap_Node
Sends all pending changes to the LDAP server
Name | Type | Description |
---|---|---|
$ldap | \Zend_Ldap |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

valid(
)
:
boolean
Check if there is a current attribute after calls to rewind() or next().
Implements Iterator
Type | Description |
---|---|
boolean |

willBeDeleted(
)
:
boolean
Is this node going to be deleted once update() is called?
Type | Description |
---|---|
boolean |