Zend_Ldap_Node provides an object oriented view into a LDAP node.

category Zend
package Zend_Ldap
subpackage Node
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Ldap_Node_Abstract

 Methods

Gets a LDAP attribute.

__get(string $name) : array
Inherited

This is an offline method.

Parameters

$name

string

Exceptions

\Zend_Ldap_Exception

Returns

array

Checks whether a given attribute exists.

__isset(string $name) : boolean
Inherited

Empty attributes will be treated as non-existent.

Parameters

$name

string

Returns

boolean

Sets a LDAP attribute.

__set(string $name, mixed $value) : null

This is an offline method.

inherited_from \Zend_Ldap_Node_Abstract::__set()

Parameters

$name

string

$value

mixed

Exceptions

\Zend_Ldap_Exception

Returns

null

Sets a LDAP attribute.

__set(string $name, mixed $value) : null
Inherited

This is an offline method.

Parameters

$name

string

$value

mixed

Exceptions

\BadMethodCallException

Returns

null

Serialization callback

__sleep() : array

Only DN and attributes will be serialized.

Returns

array

Cast to string representation {@see toString()}

__toString() : string
Inherited

Returns

string

Deletes a LDAP attribute.

__unset(string $name) : null

This method deletes the attribute.

This is an offline method.

inherited_from \Zend_Ldap_Node_Abstract::__unset()

Parameters

$name

string

Exceptions

\Zend_Ldap_Exception

Returns

null

Deletes a LDAP attribute.

__unset(string $name) : null
Inherited

This method deletes the attribute.

This is an offline method.

Parameters

$name

string

Exceptions

\BadMethodCallException

Returns

null

Deserialization callback

__wakeup() : null

Enforces a detached node.

Returns

null

Appends to the objectClass.

appendObjectClass(array|string $value) : \Zend_Ldap_Node

This is an offline method.

Parameters

$value

arraystring

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_NodeProvides a fluent interface

Appends to a LDAP attribute.

appendToAttribute(string $name, mixed $value) : \Zend_Ldap_Node

This is an offline method.

Parameters

$name

string

$value

mixed

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_NodeProvides a fluent interface

Appends to a LDAP date/time attribute.

appendToDateTimeAttribute(string $name, integer|array $value, boolean $utc = false) : \Zend_Ldap_Node

This is an offline method.

Parameters

$name

string

$value

integerarray

$utc

boolean

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_NodeProvides a fluent interface

Attach node to an LDAP connection

attachLdap(\Zend_Ldap $ldap) : \Zend_Ldap_Node

This is an offline method.

uses

Parameters

$ldap

\Zend_Ldap

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_NodeProvides a fluent interface

Checks if the given value(s) exist in the attribute

attributeHasValue(string $attribName, mixed|array $value) : boolean
Inherited

Parameters

$attribName

string

$value

mixedarray

Returns

boolean

Returns the number of attributes in node.

count() : integer
Inherited

Implements Countable

Returns

integer

Count children of current node.

countChildren() : integer

This is an online method.

Exceptions

\Zend_Ldap_Exception

Returns

integer

Count items in current subtree found by given filter.

countSubtree(string|\Zend_Ldap_Filter_Abstract $filter, integer $scope = \Zend_Ldap::SEARCH_SCOPE_SUB) : integer

This is an online method.

Parameters

$filter

string\Zend_Ldap_Filter_Abstract

$scope

integer

Exceptions

\Zend_Ldap_Exception

Returns

integer

Factory method to create a new detached Zend_Ldap_Node for a given DN.

create(string|array|\Zend_Ldap_Dn $dn, array $objectClass = array()) : \Zend_Ldap_Node
Static

Parameters

$dn

stringarray\Zend_Ldap_Dn

$objectClass

array

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_Node

Return the current attribute.

current() : array

Implements Iterator

Returns

array

Marks this node as to be deleted

delete() : \Zend_Ldap_Node

Node will be deleted on calling update() if $delete is true.

Returns

\Zend_Ldap_NodeProvides a fluent interface

Deletes a LDAP attribute.

deleteAttribute(string $name) : \Zend_Ldap_Node

This method deletes the attribute.

This is an offline method.

Parameters

$name

string

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_NodeProvides a fluent interface

Detach node from LDAP connection

detachLdap() : \Zend_Ldap_Node

This is an offline method.

Returns

\Zend_Ldap_NodeProvides a fluent interface

Check if node exists on LDAP.

exists(\Zend_Ldap $ldap = null) : boolean

This is an online method.

Parameters

$ldap

\Zend_Ldap

Exceptions

\Zend_Ldap_Exception

Returns

boolean

Checks whether a given attribute exists.

existsAttribute(string $name, boolean $emptyExists = false) : boolean
Inherited

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.

Parameters

$name

string

$emptyExists

boolean

Returns

boolean

Factory method to create a detached Zend_Ldap_Node from array data.

fromArray(array $data, boolean $fromDataSource = false) : \Zend_Ldap_Node
Static

Parameters

$data

array

$fromDataSource

boolean

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_Node

Factory method to create an attached Zend_Ldap_Node for a given DN.

fromLdap(string|array|\Zend_Ldap_Dn $dn, \Zend_Ldap $ldap) : \Zend_Ldap_Node | null
Static

Parameters

$dn

stringarray\Zend_Ldap_Dn

$ldap

\Zend_Ldap

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_Nodenull

Gets a LDAP attribute.

getAttribute(string $name, integer $index = null) : mixed
Inherited

This is an offline method.

Parameters

$name

string

$index

integer

Exceptions

\Zend_Ldap_Exception

Returns

mixed

Gets all attributes of node.

getAttributes(boolean $includeSystemAttributes = true) : array
Inherited

The collection contains all attributes.

This is an offline method.

Parameters

$includeSystemAttributes

boolean

Returns

array

Gets changed node data.

getChangedData() : array

The array contains all changed attributes. This format can be used in Zend_Ldap::add() and Zend_Ldap::update().

This is an offline method.

Returns

array

Returns all changes made.

getChanges() : array

This is an offline method.

Returns

array

Returns the children for the current node.

getChildren() : \Zend_Ldap_Node_ChildrenIterator

Can be used offline but returns an empty array if children have not been retrieved yet.

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_Node_ChildrenIterator

Gets the current DN of the current node as a Zend_Ldap_Dn.

getCurrentDn() : \Zend_Ldap_Dn

The method returns a clone of the node's DN to prohibit modification.

This is an offline method.

Returns

\Zend_Ldap_Dn

Gets node attributes.

getData(boolean $includeSystemAttributes = true) : array
Inherited

The array contains all attributes in its internal format (no conversion).

This is an offline method.

Parameters

$includeSystemAttributes

boolean

Returns

array

Gets a LDAP date/time attribute.

getDateTimeAttribute(string $name, integer $index = null) : array | integer
Inherited

This is an offline method.

Parameters

$name

string

$index

integer

Exceptions

\Zend_Ldap_Exception

Returns

arrayinteger

Gets the DN of the current node as a Zend_Ldap_Dn.

getDn() : \Zend_Ldap_Dn
Inherited

The method returns a clone of the node's DN to prohibit modification.

This is an offline method.

Returns

\Zend_Ldap_Dn

Gets the DN of the current node as an array.

getDnArray(string $caseFold = null) : array
Inherited

This is an offline method.

Parameters

$caseFold

string

Returns

array

Gets the DN of the current node as a string.

getDnString(string $caseFold = null) : string
Inherited

This is an offline method.

Parameters

$caseFold

string

Returns

string

Gets the current LDAP connection.

getLdap() : \Zend_Ldap

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap

Gets the objectClass of the node

getObjectClass() : array
Inherited

Returns

array

Returns the parent of the current node.

getParent(\Zend_Ldap $ldap = null) : \Zend_Ldap_Node

Parameters

$ldap

\Zend_Ldap

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_Node

Gets the RDN of the current node as an array.

getRdnArray(string $caseFold = null) : array
Inherited

This is an offline method.

Parameters

$caseFold

string

Returns

array

Gets the RDN of the current node as a string.

getRdnString(string $caseFold = null) : string
Inherited

This is an offline method.

Parameters

$caseFold

string

Returns

string

Checks if current node has children.

hasChildren() : boolean

Returns whether the current element has children.

Can be used offline but returns false if children have not been retrieved yet.

Exceptions

\Zend_Ldap_Exception

Returns

boolean

Checks if the current node is attached to a LDAP server.

isAttached() : boolean

This is an offline method.

Returns

boolean

Tells if the node is consiedered as new (not present on the server)

isNew() : boolean

Please note, that this doesn't tell you if the node is present on the server. Use \exits() to see if a node is already there.

Returns

boolean

Return the attribute name.

key() : string

Implements Iterator

Returns

string

{@see setDn()}

move(\Zend_Ldap_Dn|string|array $newDn) : \Zend_Ldap_Node

This is an offline method.

Parameters

$newDn

\Zend_Ldap_Dnstringarray

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_NodeProvides a fluent interface

Move forward to next attribute.

next() 

Implements Iterator

Checks whether a given attribute exists.

offsetExists(string $name) : boolean
Inherited

Implements ArrayAccess.

Empty attributes will be treated as non-existent.

Parameters

$name

string

Returns

boolean

Gets a LDAP attribute.

offsetGet(string $name) : array
Inherited

Implements ArrayAccess.

This is an offline method.

Parameters

$name

string

Exceptions

\Zend_Ldap_Exception

Returns

array

Sets a LDAP attribute.

offsetSet(string $name, mixed $value) : null

Implements ArrayAccess.

This is an offline method.

inherited_from \Zend_Ldap_Node_Abstract::offsetSet()

Parameters

$name

string

$value

mixed

Exceptions

\Zend_Ldap_Exception

Returns

null

Sets a LDAP attribute.

offsetSet(string $name, mixed $value) : null
Inherited

Implements ArrayAccess.

This is an offline method.

Parameters

$name

string

$value

mixed

Exceptions

\BadMethodCallException

Returns

null

Deletes a LDAP attribute.

offsetUnset(string $name) : null

Implements ArrayAccess.

This method deletes the attribute.

This is an offline method.

inherited_from \Zend_Ldap_Node_Abstract::offsetUnset()

Parameters

$name

string

Exceptions

\Zend_Ldap_Exception

Returns

null

Deletes a LDAP attribute.

offsetUnset(string $name) : null
Inherited

Implements ArrayAccess.

This method deletes the attribute.

This is an offline method.

Parameters

$name

string

Exceptions

\BadMethodCallException

Returns

null

Reload node attributes from LDAP.

reload(\Zend_Ldap $ldap = null) : \Zend_Ldap_Node

This is an online method.

inherited_from \Zend_Ldap_Node_Abstract::reload()

Parameters

$ldap

\Zend_Ldap

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_NodeProvides a fluent interface

Reload node attributes from LDAP.

reload(\Zend_Ldap $ldap = null) : \Zend_Ldap_Node_Abstract
Inherited

This is an online method.

Parameters

$ldap

\Zend_Ldap

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_Node_AbstractProvides a fluent interface

Removes duplicate values from a LDAP attribute

removeDuplicatesFromAttribute(string $attribName) : void

Parameters

$attribName

string

Remove given values from a LDAP attribute

removeFromAttribute(string $attribName, mixed|array $value) : void

Parameters

$attribName

string

$value

mixedarray

{@see setDn()}

rename(\Zend_Ldap_Dn|string|array $newDn) : \Zend_Ldap_Node

This is an offline method.

Parameters

$newDn

\Zend_Ldap_Dnstringarray

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_NodeProvides a fluent interface

Rewind the Iterator to the first attribute.

rewind() 

Implements Iterator

Gets children of current node.

searchChildren(string|\Zend_Ldap_Filter_Abstract $filter, string $sort = null) : \Zend_Ldap_Node_Collection

This is an online method.

Parameters

$filter

string\Zend_Ldap_Filter_Abstract

$sort

string

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_Node_Collection

Search current subtree with given options.

searchSubtree(string|\Zend_Ldap_Filter_Abstract $filter, integer $scope = \Zend_Ldap::SEARCH_SCOPE_SUB, string $sort = null) : \Zend_Ldap_Node_Collection

This is an online method.

Parameters

$filter

string\Zend_Ldap_Filter_Abstract

$scope

integer

$sort

string

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_Node_Collection

Sets a LDAP attribute.

setAttribute(string $name, mixed $value) : \Zend_Ldap_Node

This is an offline method.

Parameters

$name

string

$value

mixed

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_NodeProvides a fluent interface

Sets a LDAP date/time attribute.

setDateTimeAttribute(string $name, integer|array $value, boolean $utc = false) : \Zend_Ldap_Node

This is an offline method.

Parameters

$name

string

$value

integerarray

$utc

boolean

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_NodeProvides a fluent interface

Sets the new DN for this node

setDn(\Zend_Ldap_Dn|string|array $newDn) : \Zend_Ldap_Node

This is an offline method.

Parameters

$newDn

\Zend_Ldap_Dnstringarray

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_NodeProvides a fluent interface

Sets the objectClass.

setObjectClass(array|string $value) : \Zend_Ldap_Node

This is an offline method.

Parameters

$value

arraystring

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_NodeProvides a fluent interface

Sets a LDAP password.

setPasswordAttribute(string $password, string $hashType = \Zend_Ldap_Attribute::PASSWORD_HASH_MD5, string $attribName = 'userPassword') : \Zend_Ldap_Node

Parameters

$password

string

$hashType

string

$attribName

string

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_NodeProvides a fluent interface

Returns an array representation of the current node

toArray(boolean $includeSystemAttributes = true) : array
Inherited

Parameters

$includeSystemAttributes

boolean

Returns

array

Returns a JSON representation of the current node

toJson(boolean $includeSystemAttributes = true) : string
Inherited

Parameters

$includeSystemAttributes

boolean

Returns

string

Returns a LDIF representation of the current node

toLdif(array $options = array()) : string

Parameters

$options

array

Additional options used during encoding

Returns

string

Returns the DN of the current node. {@see getDnString()}

toString() : string
Inherited

Returns

string

Sends all pending changes to the LDAP server

update(\Zend_Ldap $ldap = null) : \Zend_Ldap_Node

Parameters

$ldap

\Zend_Ldap

Exceptions

\Zend_Ldap_Exception

Returns

\Zend_Ldap_NodeProvides a fluent interface

Check if there is a current attribute after calls to rewind() or next().

valid() : boolean

Implements Iterator

Returns

boolean

Is this node going to be deleted once update() is called?

willBeDeleted() : boolean

Returns

boolean

Is this node going to be moved once update() is called?

willBeMoved() : boolean

Returns

boolean

Constructor.

__construct(\Zend_Ldap_Dn $dn, array $data, boolean $fromDataSource, \Zend_Ldap $ldap = null

Constructor is protected to enforce the use of factory methods.

inherited_from \Zend_Ldap_Node_Abstract::__construct()

Parameters

$dn

\Zend_Ldap_Dn

$data

array

$fromDataSource

boolean

$ldap

\Zend_Ldap

Exceptions

\Zend_Ldap_Exception

Constructor.

__construct(\Zend_Ldap_Dn $dn, array $data, boolean $fromDataSource) 
Inherited

Constructor is protected to enforce the use of factory methods.

Parameters

$dn

\Zend_Ldap_Dn

$data

array

$fromDataSource

boolean

_assertChangeableAttribute()

_assertChangeableAttribute(string $name) : boolean

Parameters

$name

string

Exceptions

\Zend_Ldap_Exception

Returns

boolean

Ensures that teh RDN attributes are correctly set.

_ensureRdnAttributeValues(boolean $overwrite = false) : void

Parameters

$overwrite

boolean

True to overwrite the RDN attributes

Gets the DN of the current node as a Zend_Ldap_Dn.

_getDn() : \Zend_Ldap_Dn

This is an offline method.

inherited_from \Zend_Ldap_Node_Abstract::_getDn()

Returns

\Zend_Ldap_Dn

Gets the DN of the current node as a Zend_Ldap_Dn.

_getDn() : \Zend_Ldap_Dn
Inherited

This is an offline method.

Returns

\Zend_Ldap_Dn

_loadData()

_loadData(array $data, boolean $fromDataSource) 
inherited_from \Zend_Ldap_Node_Abstract::_loadData()

Parameters

$data

array

$fromDataSource

boolean

Exceptions

\Zend_Ldap_Exception

_loadData()

_loadData(array $data, boolean $fromDataSource) 
Inherited

Parameters

$data

array

$fromDataSource

boolean

Exceptions

\Zend_Ldap_Exception

Marks this node as new.

_markAsNew(boolean $new) 

Node will be added (instead of updated) on calling update() if $new is true.

Parameters

$new

boolean

Marks this node as to be deleted.

_markAsToBeDeleted(boolean $delete) 

Node will be deleted on calling update() if $delete is true.

Parameters

$delete

boolean

Allows post-add logic to be applied to node.

_postAdd() : void

Subclasses may override this method.

Allows post-delete logic to be applied to node.

_postDelete() : void

Subclasses may override this method.

Allows post-rename logic to be applied to node.

_postRename() : void

Subclasses may override this method.

Allows post-update logic to be applied to node.

_postUpdate() : void

Subclasses may override this method.

Allows pre-add logic to be applied to node.

_preAdd() : void

Subclasses may override this method.

Allows pre-delete logic to be applied to node.

_preDelete() : void

Subclasses may override this method.

Allows pre-rename logic to be applied to node.

_preRename() : void

Subclasses may override this method.

Allows pre-update logic to be applied to node.

_preUpdate() : void

Subclasses may override this method.

Checks if the attribute can be set and sets it accordingly.

_setAttribute(string $name, mixed $value, boolean $append) 

Parameters

$name

string

$value

mixed

$append

boolean

Exceptions

\Zend_Ldap_Exception

Checks if the attribute can be set and sets it accordingly.

_setDateTimeAttribute(string $name, integer|array $value, boolean $utc, boolean $append) 

Parameters

$name

string

$value

integerarray

$utc

boolean

$append

boolean

Exceptions

\Zend_Ldap_Exception

 Properties

 

Holds an array of the current node's children.

$_children : array

Default

 

Holds the node's current data.

$_currentData : array

Default

 

This node will be deleted

$_delete : boolean

Default

 

Holds the node's DN.

$_dn : \Zend_Ldap_Dn

Default

 

Holds the connection to the LDAP server if in connected mode.

$_ldap : \Zend_Ldap

Default

 

This node will be added

$_new : boolean

Default

 

Holds the node's new DN if node is renamed.

$_newDn : \Zend_Ldap_Dn

Default

 

Holds the node's orginal attributes (as loaded).

$_originalData : array

Default

 

$_systemAttributes

$_systemAttributes 

Default

array('createtimestamp', 'creatorsname', 'entrycsn', 'entrydn', 'entryuuid', 'hassubordinates', 'modifiersname', 'modifytimestamp', 'structuralobjectclass', 'subschemasubentry', 'distinguishedname', 'instancetype', 'name', 'objectcategory', 'objectguid', 'usnchanged', 'usncreated', 'whenchanged', 'whencreated')
Static
 

Controls iteration status

$_iteratorRewind : boolean

Default

false