From bfea7dd21e20cba68eaa110a62ae01e1c1718b80 Mon Sep 17 00:00:00 2001 From: hagen00 Date: Tue, 18 Jul 2017 15:32:40 +0200 Subject: [PATCH] Update tree.rst - previous update was misleading Previous pull request was misleading. Keeping the docs as is to make it obvious, but refactoring to encourage better code. https://github.com/cakephp/docs/pull/5102#issuecomment-316052886 --- en/orm/behaviors/tree.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/en/orm/behaviors/tree.rst b/en/orm/behaviors/tree.rst index 1f94baa5d0..7425ac3735 100644 --- a/en/orm/behaviors/tree.rst +++ b/en/orm/behaviors/tree.rst @@ -70,13 +70,12 @@ Getting a flat list of the descendants for a node is equally easy:: echo $category->name . "\n"; } -If you need to pass conditions you would do it as follows:: +If you need to pass conditions you do so as per normal:: $descendants = $categories - ->find() - ->where(['name LIKE' => '%Foo%']) - ->find('children', ['for' => 1]); - + ->find('children', ['for' => 1]) + ->where(['name LIKE' => '%Foo%']); + foreach ($descendants as $category) { echo $category->name . "\n"; }