Inheritances
Files
Overview
FRAMES
NO FRAMES

Class Zend_Ldap_Node

Zend_Ldap
|-Zend_Ldap_Node
|- class Zend_Ldap_Node extends Zend_Ldap_Node_Abstract implements Iterator, RecursiveIterator
Defined in line 41 of file Ldap/Node.php.
Zend_Ldap_Node provides an object oriented view into a LDAP node.
CategoryZend
PackageZend_Ldap
SubpackageNode
CopyrightCopyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
Licensehttp://framework.zend.com/license/new-bsd New BSD License

Summary

Instance fields
# $_children Holds an array of the current node's children
# $_delete This node will be deleted
- $_iteratorRewind Controls iteration status
# $_ldap Holds the connection to the LDAP server if in connected mode
# $_new This node will be added
# $_newDn Holds the node's new DN if node is renamed
# $_originalData Holds the node's orginal attributes (as loaded)
Static methods
+ create() Factory method to create a new detached Zend_Ldap_Node for a given DN
+ fromArray() Factory method to create a detached Zend_Ldap_Node from array data
+ fromLdap() Factory method to create an attached Zend_Ldap_Node for a given DN
Instance methods
# __construct() Constructor.
+ __set() Sets a LDAP attribute.
+ __sleep() Serialization callback
+ __unset() Deletes a LDAP attribute.
+ __wakeup() Deserialization callback
# _assertChangeableAttribute()
# _ensureRdnAttributeValues() Ensures that teh RDN attributes are correctly set
# _getDn() Gets the DN of the current node as a Zend_Ldap_Dn.
# _loadData()
# _markAsNew() Marks this node as new.
# _markAsToBeDeleted() Marks this node as to be deleted.
# _setAttribute() Checks if the attribute can be set and sets it accordingly
# _setDateTimeAttribute() Checks if the attribute can be set and sets it accordingly
+ appendObjectClass() Appends to the objectClass.
+ appendToAttribute() Appends to a LDAP attribute.
+ appendToDateTimeAttribute() Appends to a LDAP date/time attribute.
+ attachLdap() Attach node to an LDAP connection
+ countChildren() Count children of current node.
+ countSubtree() Count items in current subtree found by given filter.
+ current() Return the current attribute.
+ delete() Marks this node as to be deleted
+ deleteAttribute() Deletes a LDAP attribute.
+ detachLdap() Detach node from LDAP connection
+ exists() Check if node exists on LDAP.
+ getChangedData() Gets changed node data.
+ getChanges() Returns all changes made.
+ getChildren() Returns the children for the current node.
+ getCurrentDn() Gets the current DN of the current node as a Zend_Ldap_Dn.
+ getLdap() Gets the current LDAP connection
+ getParent() Returns the parent of the current node
+ hasChildren() Checks if current node has children.
+ isAttached() Checks if the current node is attached to a LDAP server.
+ isNew() Tells if the node is consiedered as new (not present on the server)
+ key() Return the attribute name.
+ move() {@see setDn()}
+ next() Move forward to next attribute.
+ offsetSet() Sets a LDAP attribute.
+ offsetUnset() Deletes a LDAP attribute.
+ reload() Reload node attributes from LDAP.
+ removeDuplicatesFromAttribute() Removes duplicate values from a LDAP attribute
+ removeFromAttribute() Remove given values from a LDAP attribute
+ rename() {@see setDn()}
+ rewind() Rewind the Iterator to the first attribute.
+ searchChildren() Gets children of current node.
+ searchSubtree() Search current subtree with given options.
+ setAttribute() Sets a LDAP attribute.
+ setDateTimeAttribute() Sets a LDAP date/time attribute.
+ setDn() Sets the new DN for this node
+ setObjectClass() Sets the objectClass.
+ setPasswordAttribute() Sets a LDAP password
+ toLdif() Returns a LDIF representation of the current node
+ update() Sends all pending changes to the LDAP server
+ valid() Check if there is a current attribute
+ willBeDeleted() Is this node going to be deleted once update() is called?
+ willBeMoved() Is this node going to be moved once update() is called?

Details

Instance fields

$_children
protected $_children
Holds an array of the current node's children.
Var array
$_delete
protected $_delete
This node will be deleted
Var boolean
$_iteratorRewind
private $_iteratorRewind = false
Controls iteration status
Var boolean
$_ldap
protected $_ldap
Holds the connection to the LDAP server if in connected mode.
$_new
protected $_new
This node will be added
Var boolean
$_newDn
protected $_newDn
Holds the node's new DN if node is renamed.
$_originalData
protected $_originalData
Holds the node's orginal attributes (as loaded).
Var array

Static methods

create()
public static function create( $dn
array $objectClass = array()
)
Factory method to create a new detached Zend_Ldap_Node for a given DN.
Parameters
string|array|Zend_Ldap_Dn $dn
array $objectClass
fromArray()
public static function fromArray( array $data
$fromDataSource = false
)
Factory method to create a detached Zend_Ldap_Node from array data.
Parameters
array $data
boolean $fromDataSource
fromLdap()
public static function fromLdap( $dn
Zend_Ldap $ldap
)
Factory method to create an attached Zend_Ldap_Node for a given DN.
Parameters
string|array|Zend_Ldap_Dn $dn
Zend_Ldap $ldap

Instance methods

__construct()
protected function __construct( Zend_Ldap_Dn $dn
array $data
$fromDataSource
Zend_Ldap $ldap = null
)
Constructor.

Constructor is protected to enforce the use of factory methods.
Parameters
Zend_Ldap_Dn $dn
array $data
boolean $fromDataSource
Zend_Ldap $ldap
__set()
public function __set( $name
$value
)
Sets a LDAP attribute.

This is an offline method.
Parameters
string $name
mixed $value
Returns null
__sleep()
public function __sleep( )
Serialization callback

Only DN and attributes will be serialized.
Returns array
__unset()
public function __unset( $name)
Deletes a LDAP attribute.

This method deletes the attribute.

This is an offline method.
Parameters
string $name
Returns null
__wakeup()
public function __wakeup( )
Deserialization callback

Enforces a detached node.
Returns null
_assertChangeableAttribute()
protected function _assertChangeableAttribute( $name)
Parameters
string $name
Returns boolean
_ensureRdnAttributeValues()
protected function _ensureRdnAttributeValues( )
Ensures that teh RDN attributes are correctly set.
Returns void
_getDn()
protected function _getDn( )
Gets the DN of the current node as a Zend_Ldap_Dn.

This is an offline method.
Returns Zend_Ldap_Dn
_loadData()
protected function _loadData( array $data
$fromDataSource
)
Parameters
array $data
boolean $fromDataSource
_markAsNew()
protected function _markAsNew( $new)
Marks this node as new.

Node will be added (instead of updated) on calling update() if $new is true.
Parameters
boolean $new
_markAsToBeDeleted()
protected function _markAsToBeDeleted( $delete)
Marks this node as to be deleted.

Node will be deleted on calling update() if $delete is true.
Parameters
boolean $delete
_setAttribute()
protected function _setAttribute( $name
$value
$append
)
Checks if the attribute can be set and sets it accordingly.
Parameters
string $name
mixed $value
boolean $append
_setDateTimeAttribute()
protected function _setDateTimeAttribute( $name
$value
$utc
$append
)
Checks if the attribute can be set and sets it accordingly.
Parameters
string $name
integer|array $value
boolean $utc
boolean $append
appendObjectClass()
public function appendObjectClass( $value)
Appends to the objectClass.

This is an offline method.
Parameters
array|string $value
Returns Zend_Ldap_Node *Provides a fluid interface*
appendToAttribute()
public function appendToAttribute( $name
$value
)
Appends to a LDAP attribute.

This is an offline method.
Parameters
string $name
mixed $value
Returns Zend_Ldap_Node *Provides a fluid interface*
appendToDateTimeAttribute()
public function appendToDateTimeAttribute( $name
$value
$utc = false
)
Appends to a LDAP date/time attribute.

This is an offline method.
Parameters
string $name
integer|array $value
boolean $utc
Returns Zend_Ldap_Node *Provides a fluid interface*
attachLdap()
public function attachLdap( Zend_Ldap $ldap)
Attach node to an LDAP connection

This is an offline method.
Parameters
Zend_Ldap $ldap
Returns Zend_Ldap_Node *Provides a fluid interface*
Uses Zend_Ldap_Dn::isChildOf()
countChildren()
public function countChildren( )
Count children of current node.

This is an online method.
Returns integer
countSubtree()
public function countSubtree( $filter
$scope = Zend_Ldap::SEARCH_SCOPE_SUB
)
Count items in current subtree found by given filter.

This is an online method.
Parameters
string|Zend_Ldap_Filter_Abstract $filter
integer $scope
Returns integer
current()
public function current( )
Return the current attribute.
Implements Iterator
Returns array
delete()
public function delete( )
Marks this node as to be deleted

Node will be deleted on calling update() if $delete is true.
Returns Zend_Ldap_Node *Provides a fluid interface*
deleteAttribute()
public function deleteAttribute( $name)
Deletes a LDAP attribute.

This method deletes the attribute.

This is an offline method.
Parameters
string $name
Returns Zend_Ldap_Node *Provides a fluid interface*
detachLdap()
public function detachLdap( )
Detach node from LDAP connection

This is an offline method.
Returns Zend_Ldap_Node *Provides a fluid interface*
exists()
public function exists( Zend_Ldap $ldap = null)
Check if node exists on LDAP.

This is an online method.
Parameters
Zend_Ldap $ldap
Returns boolean
getChangedData()
public function getChangedData( )
Gets changed node data.

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
getChanges()
public function getChanges( )
Returns all changes made.

This is an offline method.
Returns array
getChildren()
public function getChildren( )
Returns the children for the current node.

Can be used offline but returns an empty array if children have not been retrieved yet.
getCurrentDn()
public function getCurrentDn( )
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.
Returns Zend_Ldap_Dn
getLdap()
public function getLdap( )
Gets the current LDAP connection.
Returns Zend_Ldap
getParent()
public function getParent( Zend_Ldap $ldap = null)
Returns the parent of the current node.
Parameters
Zend_Ldap $ldap
hasChildren()
public function hasChildren( )
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.
Returns boolean
isAttached()
public function isAttached( )
Checks if the current node is attached to a LDAP server.

This is an offline method.
Returns boolean
isNew()
public function isNew( )
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 exits() to see if a node is already there.
Returns boolean
key()
public function key( )
Return the attribute name.
Implements Iterator
Returns string
move()
public function move( $newDn)
{@see setDn()}

This is an offline method.
Parameters
Zend_Ldap_Dn|string|array $newDn
Returns Zend_Ldap_Node *Provides a fluid interface*
next()
public function next( )
Move forward to next attribute.
Implements Iterator
offsetSet()
public function offsetSet( $name
$value
)
Sets a LDAP attribute.
Implements ArrayAccess.

This is an offline method.
Parameters
string $name
mixed $value
Returns null
offsetUnset()
public function offsetUnset( $name)
Deletes a LDAP attribute.
Implements ArrayAccess.

This method deletes the attribute.

This is an offline method.
Parameters
string $name
Returns null
reload()
public function reload( Zend_Ldap $ldap = null)
Reload node attributes from LDAP.

This is an online method.
Parameters
Zend_Ldap $ldap
Returns Zend_Ldap_Node *Provides a fluid interface*
removeDuplicatesFromAttribute()
public function removeDuplicatesFromAttribute( $attribName)
Removes duplicate values from a LDAP attribute
Parameters
string $attribName
Returns void
removeFromAttribute()
public function removeFromAttribute( $attribName
$value
)
Remove given values from a LDAP attribute
Parameters
string $attribName
mixed|array $value
Returns void
rename()
public function rename( $newDn)
{@see setDn()}

This is an offline method.
Parameters
Zend_Ldap_Dn|string|array $newDn
Returns Zend_Ldap_Node *Provides a fluid interface*
rewind()
public function rewind( )
Rewind the Iterator to the first attribute.
Implements Iterator
searchChildren()
public function searchChildren( $filter
$sort = null
)
Gets children of current node.

This is an online method.
Parameters
string|Zend_Ldap_Filter_Abstract $filter
string $sort
searchSubtree()
public function searchSubtree( $filter
$scope = Zend_Ldap::SEARCH_SCOPE_SUB
$sort = null
)
Search current subtree with given options.

This is an online method.
Parameters
string|Zend_Ldap_Filter_Abstract $filter
integer $scope
string $sort
setAttribute()
public function setAttribute( $name
$value
)
Sets a LDAP attribute.

This is an offline method.
Parameters
string $name
mixed $value
Returns Zend_Ldap_Node *Provides a fluid interface*
setDateTimeAttribute()
public function setDateTimeAttribute( $name
$value
$utc = false
)
Sets a LDAP date/time attribute.

This is an offline method.
Parameters
string $name
integer|array $value
boolean $utc
Returns Zend_Ldap_Node *Provides a fluid interface*
setDn()
public function setDn( $newDn)
Sets the new DN for this node

This is an offline method.
Parameters
Zend_Ldap_Dn|string|array $newDn
Returns Zend_Ldap_Node *Provides a fluid interface*
setObjectClass()
public function setObjectClass( $value)
Sets the objectClass.

This is an offline method.
Parameters
array|string $value
Returns Zend_Ldap_Node *Provides a fluid interface*
setPasswordAttribute()
public function setPasswordAttribute( $password
$hashType = Zend_Ldap_Attribute::PASSWORD_HASH_MD5
$attribName = 'userPassword'
)
Sets a LDAP password.
Parameters
string $password
string $hashType
string $attribName
Returns Zend_Ldap_Node *Provides a fluid interface*
toLdif()
public function toLdif( array $options = array())
Returns a LDIF representation of the current node
Parameters
array $options
Returns string
update()
public function update( Zend_Ldap $ldap = null)
Sends all pending changes to the LDAP server
Parameters
Zend_Ldap $ldap
Returns Zend_Ldap_Node *Provides a fluid interface*
valid()
public function valid( )
Check if there is a current attribute
after calls to rewind() or next().
Implements Iterator
Returns boolean
willBeDeleted()
public function willBeDeleted( )
Is this node going to be deleted once update() is called?
Returns boolean
willBeMoved()
public function willBeMoved( )
Is this node going to be moved once update() is called?
Returns boolean