Skip to content

Commit

Permalink
Add example for formatTreeList()
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jun 18, 2015
1 parent e7794db commit 42c12c6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion en/core-libraries/behaviors/tree.rst
Original file line number Diff line number Diff line change
Expand Up @@ -463,14 +463,20 @@ are a few more tree-orientated permutations at your disposal.
This method will return data similar to
:ref:`model-find-list` but with a nested prefix that is specified
in the ``spacer`` option to show the structure of your data.
See generateTreeList() for an example output.

Supported options are:

* ``keyPath``: A string path to the key, i.e. "{n}.Post.id".
* ``valuePath``: A string path to the value, i.e. "{n}.Post.title".
* ``spacer``: The character or characters which will be repeated.

An example would be::

$results = $this->Category->find('all');
$results = $this->Category->formatTreeList($results, array(
'spacer' => '--'
));

.. php:method:: getParentNode()
This convenience function will, as the name suggests, return the
Expand Down

0 comments on commit 42c12c6

Please sign in to comment.