[MANUAL] English:
[zend.git] / documentation / manual / en / module_specs / Zend_Ldap-API-Ldap-Node.xml
blob993e764b649d93e943aff72393f5f661e06e447a
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- Reviewed: no -->
3 <sect3 id="zend.ldap.api.reference.zend-ldap-node">
4     <title>Zend_Ldap_Node</title>
6     <para>
7         <classname>Zend_Ldap_Node</classname> includes the magic property accessors
8         <methodname>__set()</methodname>, <methodname>__get()</methodname>,
9         <methodname>__unset()</methodname> and <methodname>__isset()</methodname> to access the
10         attributes by their name. They proxy to
11         <methodname>Zend_Ldap_Node::setAttribute()</methodname>,
12         <methodname>Zend_Ldap_Node::getAttribute()</methodname>,
13         <methodname>Zend_Ldap_Node::deleteAttribute()</methodname> and
14         <methodname>Zend_Ldap_Node::existsAttribute()</methodname> respectively. Furthermore the
15         class implements <code>ArrayAccess</code> for array-style-access to the attributes.
16         <classname>Zend_Ldap_Node</classname> also implements <code>Iterator</code> and
17         <code>RecursiveIterato</code> to allow for recursive tree-traversal.
18     </para>
20     <table id="zend.ldap.api.reference.zend-ldap-node.table">
21         <title>Zend_Ldap_Node API</title>
23         <tgroup cols="2">
24             <thead>
25                 <row>
26                     <entry>Method</entry>
27                     <entry>Description</entry>
28                 </row>
29             </thead>
31             <tbody>
32                 <row>
33                     <entry><code>Zend_Ldap getLdap()</code></entry>
35                     <entry>
36                         Returns the current <acronym>LDAP</acronym> connection. Throws
37                         <classname>Zend_Ldap_Exception</classname> if current node is in detached
38                         mode (not connected to a <classname>Zend_Ldap</classname> instance).
39                     </entry>
40                 </row>
42                 <row>
43                     <entry><code>Zend_Ldap_Node attachLdap(Zend_Ldap $ldap)</code></entry>
45                     <entry>
46                         Attach the current node to the <varname>$ldap</varname>
47                         <classname>Zend_Ldap</classname> instance. Throws
48                         <classname>Zend_Ldap_Exception</classname> if <varname>$ldap</varname> is
49                         not responsible for the current node (node is not a child of the
50                         <varname>$ldap</varname> base DN).
51                     </entry>
52                 </row>
54                 <row>
55                     <entry><code>Zend_Ldap_Node detachLdap()</code></entry>
56                     <entry>Detach node from <acronym>LDAP</acronym> connection.</entry>
57                 </row>
59                 <row>
60                     <entry><code>boolean isAttached()</code></entry>
62                     <entry>
63                         Checks if the current node is attached to a <acronym>LDAP</acronym>
64                         connection.
65                     </entry>
66                 </row>
68                 <row>
69                     <entry>
70                         <emphasis><code>Zend_Ldap_Node create(string|array|Zend_Ldap_Dn $dn, array
71                             $objectClass)</code></emphasis>
72                     </entry>
74                     <entry>
75                         Factory method to create a new detached
76                         <classname>Zend_Ldap_Node</classname> for a given DN. Creates a new
77                         <classname>Zend_Ldap_Node</classname> with the DN <varname>$dn</varname> and
78                         the object-classes <varname>$objectClass</varname>.
79                     </entry>
80                 </row>
82                 <row>
83                     <entry>
84                         <emphasis><code>Zend_Ldap_Node fromLdap(string|array|Zend_Ldap_Dn $dn,
85                             Zend_Ldap $ldap)</code></emphasis>
86                     </entry>
88                     <entry>
89                         Factory method to create an attached
90                         <classname>Zend_Ldap_Node</classname> for a given DN. Loads an existing
91                         <classname>Zend_Ldap_Node</classname> with the DN <varname>$dn</varname>
92                         from the <acronym>LDAP</acronym> connection <varname>$ldap</varname>.
93                     </entry>
94                 </row>
96                 <row>
97                     <entry>
98                         <emphasis><code>Zend_Ldap_Node fromArray((array $data,
99                             boolean $fromDataSource)</code></emphasis>
100                     </entry>
102                     <entry>
103                         Factory method to create a detached <classname>Zend_Ldap_Node</classname>
104                         from array data <varname>$data</varname>. if
105                         <varname>$fromDataSource</varname> is <constant>TRUE</constant>
106                         (<constant>FALSE</constant> by default), the data is treated as beeing
107                         present in a <acronym>LDAP</acronym> tree.
108                     </entry>
109                 </row>
111                 <row>
112                     <entry><code>boolean isNew()</code></entry>
114                     <entry>
115                         Tells if the node is consiedered as new (not present on the
116                         server). Please note, that this doesn't tell if the node is really
117                         present on the server. Use <methodname>Zend_Ldap_Node::exists()</methodname>
118                         to see if a node is already there.
119                     </entry>
120                 </row>
122                 <row>
123                     <entry><code>boolean willBeDeleted()</code></entry>
125                     <entry>
126                         Tells if this node is going to be deleted once
127                         <methodname>Zend_Ldap_Node::update()</methodname> is called.
128                     </entry>
129                 </row>
131                 <row>
132                     <entry><code>Zend_Ldap_Node delete()</code></entry>
134                     <entry>
135                         Marks this node as to be deleted. Node will be deleted on
136                         calling <methodname>Zend_Ldap_Node::update()</methodname> if
137                         <methodname>Zend_Ldap_Node::willBeDeleted()</methodname> is
138                         <constant>TRUE</constant>.
139                     </entry>
140                 </row>
142                 <row>
143                     <entry><code>boolean willBeMoved()</code></entry>
145                     <entry>
146                         Tells if this node is going to be moved once
147                         <methodname>Zend_Ldap_Node::update()</methodname> is called.
148                     </entry>
149                 </row>
151                 <row>
152                     <entry><code>Zend_Ldap_Node update(Zend_Ldap $ldap)</code></entry>
154                     <entry>
155                         Sends all pending changes to the <acronym>LDAP</acronym> server. If
156                         <varname>$ldap</varname> is omitted the current <acronym>LDAP</acronym>
157                         connection is used. If the current node is detached from a
158                         <acronym>LDAP</acronym> connection a
159                         <classname>Zend_Ldap_Exception</classname> will be thrown. If
160                         <varname>$ldap</varname> is provided the current node will be attached to
161                         the given <acronym>LDAP</acronym> connection.
162                     </entry>
163                 </row>
165                 <row>
166                     <entry><code>Zend_Ldap_Dn getCurrentDn()</code></entry>
168                     <entry>
169                         Gets the current DN of the current node as a
170                         <classname>Zend_Ldap_Dn</classname>. This does not reflect possible
171                         rename-operations.
172                     </entry>
173                 </row>
175                 <row>
176                     <entry><code>Zend_Ldap_Dn getDn()</code></entry>
178                     <entry>
179                         Gets the original DN of the current node as a
180                         <classname>Zend_Ldap_Dn</classname>. This reflects possible
181                         rename-operations.
182                     </entry>
183                 </row>
185                 <row>
186                     <entry><code>string getDnString(string $caseFold)</code></entry>
188                     <entry>
189                         Gets the original DN of the current node as a string. This
190                         reflects possible rename-operations.
191                     </entry>
192                 </row>
194                 <row>
195                     <entry><code>array getDnArray(string $caseFold)</code></entry>
197                     <entry>
198                         Gets the original DN of the current node as an array. This
199                         reflects possible rename-operations.
200                     </entry>
201                 </row>
203                 <row>
204                     <entry><code>string getRdnString(string $caseFold)</code></entry>
206                     <entry>
207                         Gets the <acronym>RDN</acronym> of the current node as a string. This
208                         reflects possible rename-operations.
209                     </entry>
210                 </row>
212                 <row>
213                     <entry><code>array getRdnArray(string $caseFold)</code></entry>
215                     <entry>
216                         Gets the <acronym>RDN</acronym> of the current node as an array. This
217                         reflects possible rename-operations.
218                     </entry>
219                 </row>
221                 <row>
222                     <entry>
223                         <code>Zend_Ldap_Node setDn(Zend_Ldap_Dn|string|array $newDn)</code>
224                     </entry>
226                     <entry>
227                         Sets the new DN for this node effectively moving the node
228                         once <methodname>Zend_Ldap_Node::update()</methodname> is called.
229                     </entry>
230                 </row>
232                 <row>
233                     <entry>
234                         <code>Zend_Ldap_Node move(Zend_Ldap_Dn|string|array $newDn)</code>
235                     </entry>
237                     <entry>
238                         This is an alias for <methodname>Zend_Ldap_Node::setDn()</methodname>.
239                     </entry>
240                 </row>
242                 <row>
243                     <entry>
244                         <code>Zend_Ldap_Node rename(Zend_Ldap_Dn|string|array $newDn)</code>
245                     </entry>
247                     <entry>
248                         This is an alias for <methodname>Zend_Ldap_Node::setDn()</methodname>.
249                     </entry>
250                 </row>
252                 <row>
253                     <entry><code>array getObjectClass()</code></entry>
254                     <entry>Returns the objectClass of the node.</entry>
255                 </row>
257                 <row>
258                     <entry><code>Zend_Ldap_Node setObjectClass(array|string $value)</code></entry>
259                     <entry>Sets the objectClass attribute.</entry>
260                 </row>
262                 <row>
263                     <entry>
264                         <code>Zend_Ldap_Node appendObjectClass(array|string $value)</code>
265                     </entry>
267                     <entry>Appends to the objectClass attribute.</entry>
268                 </row>
270                 <row>
271                     <entry><code>string toLdif(array $options)</code></entry>
273                     <entry>
274                         Returns a <acronym>LDIF</acronym> representation of the current node.
275                         <varname>$options</varname> will be passed to the
276                         <classname>Zend_Ldap_Ldif_Encoder</classname>.
277                     </entry>
278                 </row>
280                 <row>
281                     <entry><code>array getChangedData()</code></entry>
283                     <entry>
284                         Gets changed node data. The array contains all changed
285                         attributes. This format can be used in
286                         <methodname>Zend_Ldap::add()</methodname> and
287                         <methodname>Zend_Ldap::update()</methodname>.
288                     </entry>
289                 </row>
291                 <row>
292                     <entry><code>array getChanges()</code></entry>
293                     <entry>Returns all changes made.</entry>
294                 </row>
296                 <row>
297                     <entry><code>string toString()</code></entry>
299                     <entry>
300                         Returns the DN of the current node - proxies to
301                         <methodname>Zend_Ldap_Dn::getDnString()</methodname>.
302                     </entry>
303                 </row>
305                 <row>
306                     <entry><code>string __toString()</code></entry>
308                     <entry>
309                         Casts to string representation - proxies to
310                         <methodname>Zend_Ldap_Dn::toString()</methodname>.
311                     </entry>
312                 </row>
314                 <row>
315                     <entry><code>array toArray(boolean $includeSystemAttributes)</code></entry>
317                     <entry>
318                         Returns an array representation of the current node. If
319                         <varname>$includeSystemAttributes</varname> is <constant>FALSE</constant>
320                         (defaults to <constant>TRUE</constant>) the system specific attributes are
321                         stripped from the array. Unlike
322                         <methodname>Zend_Ldap_Node::getAttributes()</methodname> the resulting array
323                         contains the DN with key <code>'dn'</code>.
324                     </entry>
325                 </row>
327                 <row>
328                     <entry><code>string toJson(boolean $includeSystemAttributes)</code></entry>
330                     <entry>
331                         Returns a <acronym>JSON</acronym> representation of the current node using
332                         <methodname>Zend_Ldap_Node::toArray()</methodname>.
333                     </entry>
334                 </row>
336                 <row>
337                     <entry><code>array getData(boolean $includeSystemAttributes)</code></entry>
339                     <entry>
340                         Returns the node's attributes. The array contains all
341                         attributes in its internal format (no conversion).
342                     </entry>
343                 </row>
345                 <row>
346                     <entry>
347                         <code>boolean existsAttribute(string $name, boolean $emptyExists)</code>
348                     </entry>
350                     <entry>
351                         Checks whether a given attribute exists. If
352                         <varname>$emptyExists</varname> is <constant>FALSE</constant> empty
353                         attributes (containing only array()) are treated as non-existent returning
354                         <constant>FALSE</constant>. If <varname>$emptyExists</varname> is
355                         <constant>TRUE</constant> empty attributes are treated as existent returning
356                         <constant>TRUE</constant>. In this case the method returns
357                         <constant>FALSE</constant> only if the attribute name is missing in the
358                         key-collection.
359                     </entry>
360                 </row>
362                 <row>
363                     <entry>
364                         <code>boolean attributeHasValue(string $name, mixed|array $value)</code>
365                     </entry>
367                     <entry>
368                         Checks if the given value(s) exist in the attribute. The
369                         method returns <constant>TRUE</constant> only if all values in
370                         <varname>$value</varname> are present in the attribute. Comparison is
371                         done strictly (respecting the data type).
372                     </entry>
373                 </row>
375                 <row>
376                     <entry><code>integer count()</code></entry>
378                     <entry>
379                         Returns the number of attributes in the node. Implements Countable.
380                     </entry>
381                 </row>
383                 <row>
384                     <entry>
385                         <code>mixed getAttribute(string $name, integer|null $index)</code>
386                     </entry>
388                     <entry>
389                         Gets a <acronym>LDAP</acronym> attribute. Data conversion is applied using
390                         <methodname>Zend_Ldap_Attribute::getAttribute()</methodname>.
391                     </entry>
392                 </row>
394                 <row>
395                     <entry>
396                         <code>array getAttributes(boolean $includeSystemAttributes)</code>
397                     </entry>
399                     <entry>
400                         Gets all attributes of node. If
401                         <varname>$includeSystemAttributes</varname> is <constant>FALSE</constant>
402                         (defaults to <constant>TRUE</constant>) the system specific attributes are
403                         stripped from the array.
404                     </entry>
405                 </row>
407                 <row>
408                     <entry>
409                         <code>Zend_Ldap_Node setAttribute(string $name, mixed $value)</code>
410                     </entry>
412                     <entry>
413                         Sets a <acronym>LDAP</acronym> attribute. Data conversion is applied using
414                         <methodname>Zend_Ldap_Attribute::setAttribute()</methodname>.
415                     </entry>
416                 </row>
418                 <row>
419                     <entry>
420                         <code>Zend_Ldap_Node appendToAttribute(string $name, mixed $value)</code>
421                     </entry>
423                     <entry>
424                         Appends to a <acronym>LDAP</acronym> attribute. Data conversion is applied
425                         using <methodname>Zend_Ldap_Attribute::setAttribute()</methodname>.
426                     </entry>
427                 </row>
429                 <row>
430                     <entry>
431                         <code>array|integer getDateTimeAttribute(string $name,
432                             integer|null $index)</code>
433                     </entry>
435                     <entry>
436                         Gets a <acronym>LDAP</acronym> date/time attribute. Data conversion is
437                         applied using
438                         <methodname>Zend_Ldap_Attribute::getDateTimeAttribute()</methodname>.
439                     </entry>
440                 </row>
442                 <row>
443                     <entry>
444                         <code>Zend_Ldap_Node setDateTimeAttribute(string $name,
445                             integer|array $value, boolean $utc)</code>
446                     </entry>
448                     <entry>
449                         Sets a <acronym>LDAP</acronym> date/time attribute. Data conversion is
450                         applied using
451                         <methodname>Zend_Ldap_Attribute::setDateTimeAttribute()</methodname>.
452                     </entry>
453                 </row>
455                 <row>
456                     <entry>
457                         <code>Zend_Ldap_Node appendToDateTimeAttribute(string $name,
458                             integer|array $value, boolean $utc)</code>
459                     </entry>
461                     <entry>
462                         Appends to a <acronym>LDAP</acronym> date/time attribute. Data conversion is
463                         applied using
464                         <methodname>Zend_Ldap_Attribute::setDateTimeAttribute()</methodname>.
465                     </entry>
466                 </row>
468                 <row>
469                     <entry>
470                         <code>Zend_Ldap_Node setPasswordAttribute(string $password,
471                             string $hashType, string $attribName)</code>
472                     </entry>
474                     <entry>
475                         Sets a <acronym>LDAP</acronym> password on <varname>$attribName</varname>
476                         (defaults to <code>'userPassword'</code>) to <varname>$password</varname>
477                         with the hash type <varname>$hashType</varname> (defaults to
478                         <constant>Zend_Ldap_Attribute::PASSWORD_HASH_MD5</constant>).
479                     </entry>
480                 </row>
482                 <row>
483                     <entry><code>Zend_Ldap_Node deleteAttribute(string $name)</code></entry>
484                     <entry>Deletes a <acronym>LDAP</acronym> attribute.</entry>
485                 </row>
487                 <row>
488                     <entry><code>void removeDuplicatesFromAttribute(string$name)</code></entry>
490                     <entry>
491                         Removes duplicate values from a <acronym>LDAP</acronym> attribute.
492                     </entry>
493                 </row>
495                 <row>
496                     <entry>
497                         <code>void removeFromAttribute(string $attribName,
498                             mixed|array $value)</code>
499                     </entry>
501                     <entry>
502                         Removes the given values from a <acronym>LDAP</acronym> attribute.
503                     </entry>
504                 </row>
506                 <row>
507                     <entry><code>boolean exists(Zend_Ldap $ldap)</code></entry>
509                     <entry>
510                         Checks if the current node exists on the given <acronym>LDAP</acronym>
511                         server (current server is used if <constant>NULL</constant> is passed).
512                     </entry>
513                 </row>
515                 <row>
516                     <entry><code>Zend_Ldap_Node reload(Zend_Ldap $ldap)</code></entry>
518                     <entry>
519                         Reloads the current node's attributes from the given <acronym>LDAP</acronym>
520                         server (current server is used if <constant>NULL</constant> is
521                         passed).
522                     </entry>
523                 </row>
525                 <row>
526                     <entry>
527                         <code>Zend_Ldap_Node_Collection
528                             searchSubtree(string|Zend_Ldap_Filter_Abstract $filter, integer
529                             $scope, string $sort)</code>
530                     </entry>
532                     <entry>
533                         Searches the nodes's subtree with the given
534                         <varname>$filter</varname> and the given search parameters. See
535                         <methodname>Zend_Ldap::search()</methodname> for details on the parameters
536                         <varname>$scope</varname> and <varname>$sort</varname>.
537                     </entry>
538                 </row>
540                 <row>
541                     <entry>
542                         <code>integer countSubtree(string|Zend_Ldap_Filter_Abstract
543                             $filter, integer $scope)</code>
544                     </entry>
546                     <entry>
547                         Count the nodes's subtree items matching the given
548                         <varname>$filter</varname> and the given search scope. See
549                         <methodname>Zend_Ldap::search()</methodname> for details on the
550                         <varname>$scope</varname> parameter.
551                     </entry>
552                 </row>
554                 <row>
555                     <entry><code>integer countChildren()</code></entry>
556                     <entry>Count the nodes's children.</entry>
557                 </row>
559                 <row>
560                     <entry>
561                         <code>Zend_Ldap_Node_Collection
562                             searchChildren(string|Zend_Ldap_Filter_Abstract $filter, string
563                             $sort)</code>
564                     </entry>
566                     <entry>
567                         Searches the nodes's children matching the given
568                         <varname>$filter</varname>. See <methodname>Zend_Ldap::search()</methodname>
569                         for details on the <varname>$sort</varname> parameter.
570                     </entry>
571                 </row>
573                 <row>
574                     <entry><code>boolean hasChildren()</code></entry>
575                     <entry>Returns whether the current node has children.</entry>
576                 </row>
578                 <row>
579                     <entry><code>Zend_Ldap_Node_ChildrenIterator getChildren()</code></entry>
580                     <entry>Returns all children of the current node.</entry>
581                 </row>
583                 <row>
584                     <entry><code>Zend_Ldap_Node getParent(Zend_Ldap $ldap)</code></entry>
586                     <entry>
587                         Returns the parent of the current node using the <acronym>LDAP</acronym>
588                         connection <varname>$ldap</varname> (uses the current
589                         <acronym>LDAP</acronym> connection if omitted).
590                     </entry>
591                 </row>
592             </tbody>
593         </tgroup>
594     </table>
595 </sect3>