# Zend_Ldap_Node_Schema

The following methods are available on all vendor-specific subclasses.

`Zend_Ldap_Node_Schema` includes the magic property accessors `__get()` and `__isset()` to access the attributes by their name. They proxy to `Zend_Ldap_Node_Schema::getAttribute()` and `Zend_Ldap_Node_Schema::existsAttribute()` respectively. `__set()` and `__unset()` are also implemented, but they throw a `BadMethodCallException` as modifications are not allowed on RootDSE nodes. Furthermore the class implements `ArrayAccess` for array-style-access to the attributes. `offsetSet()` and `offsetUnset()` also throw a `BadMethodCallException` due to obvious reasons.

## Zend_Ldap_Node_Schema API

Method | Description
--- | ---
`Zend_Ldap_Dn getDn()` | Gets the DN of the current node as a `Zend_Ldap_Dn`.
`string getDnString(string $caseFold)` | Gets the DN of the current node as a string.
`array getDnArray(string $caseFold)` | Gets the DN of the current node as an array.
`string getRdnString(string $caseFold)` | Gets the RDN of the current node as a string.
`array getRdnArray(string $caseFold)` | Gets the RDN of the current node as an array.
`array getObjectClass()` | Returns the objectClass of the node.
`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_Schema::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_Schema::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.
`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_Schema reload(Zend_Ldap $ldap)` | Reloads the current node's attributes from the given LDAP server.
`Zend_Ldap_Node_Schema create(Zend_Ldap $ldap)` | Factory method to create the Schema node.
`array getAttributeTypes()` | Gets the attribute types as an array of ``.
`array getObjectClasses()` | Gets the object classes as an array of `Zend_Ldap_Node_Schema_ObjectClass_Interface`.

## Zend_Ldap_Node_Schema_AttributeType_Interface API

Method | Description
--- | ---
`string getName()` | Gets the attribute name.
`string getOid()` | Gets the attribute OID.
`string getSyntax()` | Gets the attribute syntax.
`int|null getMaxLength()` | Gets the attribute maximum length.
`boolean isSingleValued()` | Returns if the attribute is single-valued.
`string getDescription()` | Gets the attribute description

## Zend_Ldap_Node_Schema_ObjectClass_Interface API

Method | Description
--- | ---
`string getName()` | Returns the objectClass name.
`string getOid()` | Returns the objectClass OID.
`array getMustContain()` | Returns the attributes that this objectClass must contain.
`array getMayContain()` | Returns the attributes that this objectClass may contain.
`string getDescription()` | Returns the attribute description

`integer getType()`

Returns the objectClass type. The method returns one of the following values:

`Zend_Ldap_Node_Schema::OBJECTCLASS_TYPE_UNKNOWN`

  for unknown class types

`Zend_Ldap_Node_Schema::OBJECTCLASS_TYPE_STRUCTURAL`

  for structural classes

`Zend_Ldap_Node_Schema::OBJECTCLASS_TYPE_ABSTRACT`

  for abstract classes

`Zend_Ldap_Node_Schema::OBJECTCLASS_TYPE_AUXILIARY`

  for auxiliary classes

`array getParentClasses()` | Returns the parent objectClasses of this class. This includes structural, abstract and auxiliary objectClasses.

Classes representing attribute types and object classes extend `Zend_Ldap_Node_Schema_Item` which provides some core methods to access arbitrary attributes on the underlying LDAP node. `Zend_Ldap_Node_Schema_Item` includes the magic property accessors `__get()` and `__isset()` to access the attributes by their name. Furthermore the class implements `ArrayAccess` for array-style-access to the attributes. `offsetSet()` and `offsetUnset()` throw a `BadMethodCallException` as modifications are not allowed on schema information nodes.

## Zend_Ldap_Node_Schema_Item API

Method | Description
--- | ---
`array getData()` | Gets all the underlying data from the schema information node.
`integer count()` | Returns the number of attributes in this schema information node. Implements Countable.

## OpenLDAP

Additionally the common methods above apply to instances of `Zend_Ldap_Node_Schema_OpenLDAP`.

### Zend_Ldap_Node_Schema_OpenLDAP API

Method | Description
--- | ---
`array getLdapSyntaxes()` | Gets the LDAP syntaxes.
`array getMatchingRules()` | Gets the matching rules.
`array getMatchingRuleUse()` | Gets the matching rule use.

### Zend_Ldap_Node_Schema_AttributeType_OpenLDAP API

Method | Description
--- | ---
`Zend_Ldap_Node_Schema_AttributeType_OpenLdap|null getParent()` | Returns the parent attribute type in the inheritance tree if one exists.

### Zend_Ldap_Node_Schema_ObjectClass_OpenLDAP API

Method | Description
--- | ---
`array getParents()` | Returns the parent object classes in the inheritance tree if one exists. The returned array is an array of `Zend_Ldap_Node_Schema_ObjectClass_OpenLdap`.

## ActiveDirectory

### Schema browsing on ActiveDirectory servers

Due to restrictions on Microsoft ActiveDirectory servers regarding the number of entries returned by generic search routines and due to the structure of the ActiveDirectory schema repository, schema browsing is currently not available for Microsoft ActiveDirectory servers.

`Zend_Ldap_Node_Schema_ActiveDirectory` does not provide any additional methods.

### Zend_Ldap_Node_Schema_AttributeType_ActiveDirectory API

`Zend_Ldap_Node_Schema_AttributeType_ActiveDirectory` does not provide any additional methods.

### Zend_Ldap_Node_Schema_ObjectClass_ActiveDirectory API

`Zend_Ldap_Node_Schema_ObjectClass_ActiveDirectory` does not provide any additional methods.