From: "Guilherme Blanco" <guilhermebla...@gmail.com>
Date: Fri, 4 Jul 2008 14:51:12 -0300
Local: Fri 4 Jul 2008 18:51
Subject: Re: [doctrine-user] Fetching Nested Set as hierarchical array
Hi....
change this line: $item = $node; to this one: $item = ($node instanceof This is just a fix in case the user pass Doctrine_Records instead of arrays. Cheers, On Fri, Jul 4, 2008 at 2:32 PM, Guilherme Blanco <guilhermebla...@gmail.com> wrote: -- > Hi miros, > I already developed the patch to support this, but only in HYDRATE_ARRAY mode. > By not, here is my solution... it adds a __children index in the > Here is the probably to-be added method toHierarchy: > public function toHierarchy($collection) > if (count($collection) > 0) { > foreach ($collection as $node) { > // Number of stack items > // Check if we're dealing with different levels > // Stack is empty (we are inspecting the root) > return $trees; > And here is the method I use to remove the children index to be > protected function _mapHierarchy($data) > for ($i = 0, $l = count($children); $i < $l; $i++) > return array_merge($data, $children); > If you need any assistance, just reply to this message.... > Cheers, > On Fri, Jul 4, 2008 at 9:39 AM, miros <mmir...@gmail.com> wrote: >> I have a table that uses nested set. > -- Guilherme Blanco - Web Developer CBC - Certified Bindows Consultant Cell Phone: +55 (16) 9166-6902 MSN: guilhermebla...@hotmail.com URL: http://blog.bisna.com Rio de Janeiro - RJ/Brazil You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||