Node
extends AbstractNode
in package
implements
Iterator, RecursiveIterator
Laminas\Ldap\Node provides an object oriented view into a LDAP node.
Tags
Table of Contents
Interfaces
- Iterator
- RecursiveIterator
Properties
- $children : array<string, Node>|null
- Holds an array of the current node's children.
- $currentData : array<string|int, mixed>
- Holds the node's current data.
- $delete : bool
- This node will be deleted
- $dn : Dn
- Holds the node's DN.
- $events : EventManager
- $ldap : Ldap
- Holds the connection to the LDAP server if in connected mode.
- $new : bool
- This node will be added
- $newDn : Dn
- Holds the node's new Dn if node is renamed.
- $originalData : array<string|int, mixed>
- Holds the node's original attributes (as loaded).
- $systemAttributes : array<int, non-empty-string>
- $iteratorRewind : bool
- Controls iteration status
Methods
- __get() : mixed
- Gets a LDAP attribute.
- __isset() : bool
- Checks whether a given attribute exists.
- __set() : mixed
- Sets a LDAP attribute.
- __sleep() : array<string|int, mixed>
- Serialization callback
- __toString() : string
- Cast to string representation {@see toString()}
- __unset() : mixed
- Deletes a LDAP attribute.
- __wakeup() : mixed
- Deserialization callback
- appendObjectClass() : Node
- Appends to the objectClass.
- appendToAttribute() : Node
- Appends to a LDAP attribute.
- appendToDateTimeAttribute() : Node
- Appends to a LDAP date/time attribute.
- attachLdap() : Node
- Attach node to an LDAP connection
- attributeHasValue() : bool
- Checks if the given value(s) exist in the attribute
- count() : mixed
- countChildren() : int
- Count children of current node.
- countSubtree() : int
- Count items in current subtree found by given filter.
- create() : Node
- Factory method to create a new detached Laminas\Ldap\Node for a given DN.
- current() : mixed
- delete() : Node
- Marks this node as to be deleted
- deleteAttribute() : Node
- Deletes a LDAP attribute.
- detachLdap() : Node
- Detach node from LDAP connection
- exists() : bool
- Check if node exists on LDAP.
- existsAttribute() : bool
- Checks whether a given attribute exists.
- fromArray() : Node
- Factory method to create a detached Laminas\Ldap\Node from array data.
- fromLdap() : Node|null
- Factory method to create an attached Laminas\Ldap\Node for a given DN.
- getAttribute() : mixed
- Gets a LDAP attribute.
- getAttributes() : array<string|int, mixed>
- Gets all attributes of node.
- getChangedData() : array<string|int, mixed>
- Gets changed node data.
- getChanges() : array<string|int, mixed>
- Returns all changes made.
- getChildren() : ChildrenIterator
- Returns the children for the current node.
- getCurrentDn() : Dn
- Gets the current DN of the current node as a Laminas\Ldap\Dn.
- getData() : array<string|int, mixed>
- Gets node attributes.
- getDateTimeAttribute() : array<string|int, mixed>|int
- Gets a LDAP date/time attribute.
- getDn() : Dn
- Gets the DN of the current node as a Laminas\Ldap\Dn.
- getDnArray() : array<string|int, mixed>
- Gets the DN of the current node as an array.
- getDnString() : string
- Gets the DN of the current node as a string.
- getLdap() : Ldap
- Gets the current LDAP connection.
- getObjectClass() : array<string|int, mixed>
- Gets the objectClass of the node
- getParent() : Node
- Returns the parent of the current node.
- getRdnArray() : array<string|int, mixed>
- Gets the RDN of the current node as an array.
- getRdnString() : string
- Gets the RDN of the current node as a string.
- hasChildren() : mixed
- isAttached() : bool
- Checks if the current node is attached to a LDAP server.
- isNew() : bool
- Tells if the node is considered as new (not present on the server)
- key() : mixed
- move() : Node
- {@see setDn()}
- next() : mixed
- offsetExists() : mixed
- offsetGet() : mixed
- offsetSet() : void
- offsetUnset() : void
- reload() : Node
- Reload node attributes from LDAP.
- removeDuplicatesFromAttribute() : void
- Removes duplicate values from a LDAP attribute
- removeFromAttribute() : void
- Remove given values from a LDAP attribute
- rename() : Node
- {@see setDn()}
- rewind() : mixed
- searchChildren() : Collection
- Gets children of current node.
- searchSubtree() : Collection
- Search current subtree with given options.
- setAttribute() : Node
- Sets a LDAP attribute.
- setDateTimeAttribute() : Node
- Sets a LDAP date/time attribute.
- setDn() : Node
- Sets the new DN for this node
- setObjectClass() : Node
- Sets the objectClass.
- setPasswordAttribute() : Node
- Sets a LDAP password.
- toArray() : array<string|int, mixed>
- Returns an array representation of the current node
- toJson() : string
- Returns a JSON representation of the current node
- toLdif() : string
- Returns a LDIF representation of the current node
- toString() : string
- Returns the DN of the current node. {@see getDnString()}
- update() : Node
- Sends all pending changes to the LDAP server
- valid() : mixed
- willBeDeleted() : bool
- Is this node going to be deleted once update() is called?
- willBeMoved() : bool
- Is this node going to be moved once update() is called?
- __construct() : mixed
- Constructor is protected to enforce the use of factory methods.
- _getDn() : Dn
- Gets the DN of the current node as a Laminas\Ldap\Dn.
- _setAttribute() : mixed
- Checks if the attribute can be set and sets it accordingly.
- _setDateTimeAttribute() : mixed
- Checks if the attribute can be set and sets it accordingly.
- assertChangeableAttribute() : bool
- ensureRdnAttributeValues() : void
- Ensures that teh RDN attributes are correctly set.
- loadData() : mixed
- markAsNew() : mixed
- Marks this node as new.
- markAsToBeDeleted() : mixed
- Marks this node as to be deleted.
- triggerEvent() : mixed
- Trigger an event
- getEventManager() : null|EventManager
- Attempt to marshal an EventManager instance.
Properties
$children
Holds an array of the current node's children.
protected
array<string, Node>|null
$children
$currentData
Holds the node's current data.
protected
array<string|int, mixed>
$currentData
$delete
This node will be deleted
protected
bool
$delete
$dn
Holds the node's DN.
protected
Dn
$dn
$events
protected
EventManager
$events
$ldap
Holds the connection to the LDAP server if in connected mode.
protected
Ldap
$ldap
$new
This node will be added
protected
bool
$new
$newDn
Holds the node's new Dn if node is renamed.
protected
Dn
$newDn
$originalData
Holds the node's original attributes (as loaded).
protected
array<string|int, mixed>
$originalData
$systemAttributes
protected
static array<int, non-empty-string>
$systemAttributes
= ['createtimestamp', 'creatorsname', 'entrycsn', 'entrydn', 'entryuuid', 'hassubordinates', 'modifiersname', 'modifytimestamp', 'structuralobjectclass', 'subschemasubentry', 'distinguishedname', 'instancetype', 'name', 'objectcategory', 'objectguid', 'usnchanged', 'usncreated', 'whenchanged', 'whencreated']
$iteratorRewind
Controls iteration status
private
bool
$iteratorRewind
= false
Methods
__get()
Gets a LDAP attribute.
public
__get(string $name) : mixed
This is an offline method.
Parameters
- $name : string
Tags
__isset()
Checks whether a given attribute exists.
public
__isset(string $name) : bool
Empty attributes will be treated as non-existent.
Parameters
- $name : string
Return values
bool__set()
Sets a LDAP attribute.
public
__set(string $name, mixed $value) : mixed
This is an offline method.
Parameters
- $name : string
- $value : mixed
__sleep()
Serialization callback
public
__sleep() : array<string|int, mixed>
Only Dn and attributes will be serialized.
Return values
array<string|int, mixed>__toString()
Cast to string representation {@see toString()}
public
__toString() : string
Return values
string__unset()
Deletes a LDAP attribute.
public
__unset(string $name) : mixed
This method deletes the attribute.
This is an offline method.
Parameters
- $name : string
Tags
__wakeup()
Deserialization callback
public
__wakeup() : mixed
Enforces a detached node.
appendObjectClass()
Appends to the objectClass.
public
appendObjectClass(array<string|int, mixed>|string $value) : Node
This is an offline method.
Parameters
- $value : array<string|int, mixed>|string
Tags
Return values
Node —Provides a fluid interface
appendToAttribute()
Appends to a LDAP attribute.
public
appendToAttribute(string $name, mixed $value) : Node
This is an offline method.
Parameters
- $name : string
- $value : mixed
Tags
Return values
Node —Provides a fluid interface
appendToDateTimeAttribute()
Appends to a LDAP date/time attribute.
public
appendToDateTimeAttribute(string $name, int|array<string|int, mixed> $value[, bool $utc = false ]) : Node
This is an offline method.
Parameters
- $name : string
- $value : int|array<string|int, mixed>
- $utc : bool = false
Tags
Return values
Node —Provides a fluid interface
attachLdap()
Attach node to an LDAP connection
public
attachLdap(Ldap $ldap) : Node
This is an offline method.
Parameters
- $ldap : Ldap
Tags
Return values
Node —Provides a fluid interface
attributeHasValue()
Checks if the given value(s) exist in the attribute
public
attributeHasValue(string $attribName, mixed|array<string|int, mixed> $value) : bool
Parameters
- $attribName : string
- $value : mixed|array<string|int, mixed>
Return values
boolcount()
public
count() : mixed
Tags
Attributes
countChildren()
Count children of current node.
public
countChildren() : int
This is an online method.
Tags
Return values
intcountSubtree()
Count items in current subtree found by given filter.
public
countSubtree(string|AbstractFilter $filter[, int $scope = Ldap::SEARCH_SCOPE_SUB ]) : int
This is an online method.
Parameters
- $filter : string|AbstractFilter
- $scope : int = Ldap::SEARCH_SCOPE_SUB
Tags
Return values
intcreate()
Factory method to create a new detached Laminas\Ldap\Node for a given DN.
public
static create(string|array<string|int, mixed>|Dn $dn[, array<string|int, mixed> $objectClass = [] ]) : Node
Parameters
- $dn : string|array<string|int, mixed>|Dn
- $objectClass : array<string|int, mixed> = []
Tags
Return values
Nodecurrent()
public
current() : mixed
Tags
Attributes
delete()
Marks this node as to be deleted
public
delete() : Node
Node will be deleted on calling update() if $delete is true.
Return values
Node —Provides a fluid interface
deleteAttribute()
Deletes a LDAP attribute.
public
deleteAttribute(string $name) : Node
This method deletes the attribute.
This is an offline method.
Parameters
- $name : string
Tags
Return values
Node —Provides a fluid interface
detachLdap()
Detach node from LDAP connection
public
detachLdap() : Node
This is an offline method.
Return values
Node —Provides a fluid interface
exists()
Check if node exists on LDAP.
public
exists([Ldap|null $ldap = null ]) : bool
This is an online method.
Parameters
- $ldap : Ldap|null = null
Tags
Return values
boolexistsAttribute()
Checks whether a given attribute exists.
public
existsAttribute(string $name[, bool $emptyExists = false ]) : bool
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 : bool = false
Return values
boolfromArray()
Factory method to create a detached Laminas\Ldap\Node from array data.
public
static fromArray(array<string|int, mixed> $data[, bool $fromDataSource = false ]) : Node
Parameters
- $data : array<string|int, mixed>
- $fromDataSource : bool = false
Tags
Return values
NodefromLdap()
Factory method to create an attached Laminas\Ldap\Node for a given DN.
public
static fromLdap(string|array<string|int, mixed>|Dn $dn, Ldap $ldap) : Node|null
Parameters
Tags
Return values
Node|nullgetAttribute()
Gets a LDAP attribute.
public
getAttribute(string $name[, int $index = null ]) : mixed
This is an offline method.
Parameters
- $name : string
- $index : int = null
Tags
getAttributes()
Gets all attributes of node.
public
getAttributes([bool $includeSystemAttributes = true ]) : array<string|int, mixed>
The collection contains all attributes.
This is an offline method.
Parameters
- $includeSystemAttributes : bool = true
Return values
array<string|int, mixed>getChangedData()
Gets changed node data.
public
getChangedData() : array<string|int, mixed>
The array contains all changed attributes. This format can be used in and .
This is an offline method.
Return values
array<string|int, mixed>getChanges()
Returns all changes made.
public
getChanges() : array<string|int, mixed>
This is an offline method.
Return values
array<string|int, mixed>getChildren()
Returns the children for the current node.
public
getChildren() : ChildrenIterator
Can be used offline but returns an empty array if children have not been retrieved yet.
Tags
Attributes
Return values
ChildrenIteratorgetCurrentDn()
Gets the current DN of the current node as a Laminas\Ldap\Dn.
public
getCurrentDn() : Dn
The method returns a clone of the node's DN to prohibit modification.
This is an offline method.
Return values
DngetData()
Gets node attributes.
public
getData([bool $includeSystemAttributes = true ]) : array<string|int, mixed>
The array contains all attributes in its internal format (no conversion).
This is an offline method.
Parameters
- $includeSystemAttributes : bool = true
Return values
array<string|int, mixed>getDateTimeAttribute()
Gets a LDAP date/time attribute.
public
getDateTimeAttribute(string $name[, int $index = null ]) : array<string|int, mixed>|int
This is an offline method.
Parameters
- $name : string
- $index : int = null
Tags
Return values
array<string|int, mixed>|intgetDn()
Gets the DN of the current node as a Laminas\Ldap\Dn.
public
getDn() : Dn
The method returns a clone of the node's DN to prohibit modification.
This is an offline method.
Return values
DngetDnArray()
Gets the DN of the current node as an array.
public
getDnArray([string $caseFold = null ]) : array<string|int, mixed>
This is an offline method.
Parameters
- $caseFold : string = null
Return values
array<string|int, mixed>getDnString()
Gets the DN of the current node as a string.
public
getDnString([string $caseFold = null ]) : string
This is an offline method.
Parameters
- $caseFold : string = null
Return values
stringgetLdap()
Gets the current LDAP connection.
public
getLdap() : Ldap
Tags
Return values
LdapgetObjectClass()
Gets the objectClass of the node
public
getObjectClass() : array<string|int, mixed>
Return values
array<string|int, mixed>getParent()
Returns the parent of the current node.
public
getParent([Ldap|null $ldap = null ]) : Node
Parameters
- $ldap : Ldap|null = null
Tags
Return values
NodegetRdnArray()
Gets the RDN of the current node as an array.
public
getRdnArray([string $caseFold = null ]) : array<string|int, mixed>
This is an offline method.
Parameters
- $caseFold : string = null
Return values
array<string|int, mixed>getRdnString()
Gets the RDN of the current node as a string.
public
getRdnString([string $caseFold = null ]) : string
This is an offline method.
Parameters
- $caseFold : string = null
Return values
stringhasChildren()
public
hasChildren() : mixed
Tags
Attributes
isAttached()
Checks if the current node is attached to a LDAP server.
public
isAttached() : bool
This is an offline method.
Return values
boolisNew()
Tells if the node is considered as new (not present on the server)
public
isNew() : bool
Please note, that this doesn't tell you if the node is present on the server. Use to see if a node is already there.
Return values
boolkey()
public
key() : mixed
Tags
Attributes
move()
{@see setDn()}
public
move(Dn|string|array<string|int, mixed> $newDn) : Node
This is an offline method.
Parameters
- $newDn : Dn|string|array<string|int, mixed>
Tags
Return values
Node —Provides a fluid interface
next()
public
next() : mixed
Tags
Attributes
offsetExists()
public
offsetExists(mixed $offset) : mixed
Parameters
- $offset : mixed
Tags
Attributes
offsetGet()
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
Tags
Attributes
offsetSet()
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
Tags
offsetUnset()
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
Tags
reload()
Reload node attributes from LDAP.
public
reload([Ldap|null $ldap = null ]) : Node
This is an online method.
Parameters
- $ldap : Ldap|null = null
Tags
Return values
Node —Provides a fluid interface
removeDuplicatesFromAttribute()
Removes duplicate values from a LDAP attribute
public
removeDuplicatesFromAttribute(string $attribName) : void
Parameters
- $attribName : string
removeFromAttribute()
Remove given values from a LDAP attribute
public
removeFromAttribute(string $attribName, mixed|array<string|int, mixed> $value) : void
Parameters
- $attribName : string
- $value : mixed|array<string|int, mixed>
rename()
{@see setDn()}
public
rename(Dn|string|array<string|int, mixed> $newDn) : Node
This is an offline method.
Parameters
- $newDn : Dn|string|array<string|int, mixed>
Tags
Return values
Node —Provides a fluid interface
rewind()
public
rewind() : mixed
Tags
Attributes
searchChildren()
Gets children of current node.
public
searchChildren(string|AbstractFilter $filter[, string $sort = null ]) : Collection
This is an online method.
Parameters
- $filter : string|AbstractFilter
- $sort : string = null
Tags
Return values
CollectionsearchSubtree()
Search current subtree with given options.
public
searchSubtree(string|AbstractFilter $filter[, int $scope = Ldap::SEARCH_SCOPE_SUB ][, string $sort = null ]) : Collection
This is an online method.
Parameters
- $filter : string|AbstractFilter
- $scope : int = Ldap::SEARCH_SCOPE_SUB
- $sort : string = null
Tags
Return values
CollectionsetAttribute()
Sets a LDAP attribute.
public
setAttribute(string $name, mixed $value) : Node
This is an offline method.
Parameters
- $name : string
- $value : mixed
Tags
Return values
Node —Provides a fluid interface
setDateTimeAttribute()
Sets a LDAP date/time attribute.
public
setDateTimeAttribute(string $name, int|array<string|int, mixed> $value[, bool $utc = false ]) : Node
This is an offline method.
Parameters
- $name : string
- $value : int|array<string|int, mixed>
- $utc : bool = false
Tags
Return values
Node —Provides a fluid interface
setDn()
Sets the new DN for this node
public
setDn(Dn|string|array<string|int, mixed> $newDn) : Node
This is an offline method.
Parameters
- $newDn : Dn|string|array<string|int, mixed>
Tags
Return values
Node —Provides a fluid interface
setObjectClass()
Sets the objectClass.
public
setObjectClass(array<string|int, mixed>|string $value) : Node
This is an offline method.
Parameters
- $value : array<string|int, mixed>|string
Tags
Return values
Node —Provides a fluid interface
setPasswordAttribute()
Sets a LDAP password.
public
setPasswordAttribute(string $password[, string $hashType = Attribute::PASSWORD_HASH_MD5 ][, string $attribName = 'userPassword' ]) : Node
Parameters
- $password : string
- $hashType : string = Attribute::PASSWORD_HASH_MD5
- $attribName : string = 'userPassword'
Tags
Return values
Node —Provides a fluid interface
toArray()
Returns an array representation of the current node
public
toArray([bool $includeSystemAttributes = true ]) : array<string|int, mixed>
Parameters
- $includeSystemAttributes : bool = true
Return values
array<string|int, mixed>toJson()
Returns a JSON representation of the current node
public
toJson([bool $includeSystemAttributes = true ]) : string
Parameters
- $includeSystemAttributes : bool = true
Return values
stringtoLdif()
Returns a LDIF representation of the current node
public
toLdif([array<string|int, mixed> $options = [] ]) : string
Parameters
- $options : array<string|int, mixed> = []
-
Additional options used during encoding
Return values
stringtoString()
Returns the DN of the current node. {@see getDnString()}
public
toString() : string
Return values
stringupdate()
Sends all pending changes to the LDAP server
public
update([Ldap|null $ldap = null ]) : Node
Parameters
- $ldap : Ldap|null = null
Tags
Return values
Node —Provides a fluid interface
valid()
public
valid() : mixed
Tags
Attributes
willBeDeleted()
Is this node going to be deleted once update() is called?
public
willBeDeleted() : bool
Return values
boolwillBeMoved()
Is this node going to be moved once update() is called?
public
willBeMoved() : bool
Return values
bool__construct()
Constructor is protected to enforce the use of factory methods.
protected
__construct(Dn $dn, array<string|int, mixed> $data, bool $fromDataSource[, Ldap|null $ldap = null ]) : mixed
Parameters
Tags
_getDn()
Gets the DN of the current node as a Laminas\Ldap\Dn.
protected
_getDn() : Dn
This is an offline method.
Return values
Dn_setAttribute()
Checks if the attribute can be set and sets it accordingly.
protected
_setAttribute(string $name, mixed $value, bool $append) : mixed
Parameters
- $name : string
- $value : mixed
- $append : bool
Tags
_setDateTimeAttribute()
Checks if the attribute can be set and sets it accordingly.
protected
_setDateTimeAttribute(string $name, int|array<string|int, mixed> $value, bool $utc, bool $append) : mixed
Parameters
- $name : string
- $value : int|array<string|int, mixed>
- $utc : bool
- $append : bool
Tags
assertChangeableAttribute()
protected
assertChangeableAttribute(string $name) : bool
Parameters
- $name : string
Tags
Return values
boolensureRdnAttributeValues()
Ensures that teh RDN attributes are correctly set.
protected
ensureRdnAttributeValues([bool $overwrite = false ]) : void
Parameters
- $overwrite : bool = false
-
True to overwrite the RDN attributes
loadData()
protected
loadData(array<string|int, mixed> $data, bool $fromDataSource) : mixed
Parameters
- $data : array<string|int, mixed>
- $fromDataSource : bool
Tags
markAsNew()
Marks this node as new.
protected
markAsNew(bool $new) : mixed
Node will be added (instead of updated) on calling update() if $new is true.
Parameters
- $new : bool
markAsToBeDeleted()
Marks this node as to be deleted.
protected
markAsToBeDeleted(bool $delete) : mixed
Node will be deleted on calling update() if $delete is true.
Parameters
- $delete : bool
triggerEvent()
Trigger an event
protected
triggerEvent(string $event[, array<string|int, mixed>|ArrayAccess $argv = [] ]) : mixed
Parameters
- $event : string
-
Event name
- $argv : array<string|int, mixed>|ArrayAccess = []
-
Array of arguments; typically, should be associative
getEventManager()
Attempt to marshal an EventManager instance.
private
getEventManager() : null|EventManager
If an instance is already available, return it.
If the laminas-eventmanager component is not present, return nothing.
Otherwise, marshal the instance in a version-agnostic way, and return it.