cakePHP 2.0 find('threaded') Issue

I am running the following in my Jobs controller.

$this->set('jobs', $this->Job->find('threaded', array('conditions' => array('Job.id' => 20))));

Open in new window


Now on my view I am displaying $jobs in my foreach loop fine but my issue is I have children linked to Job.id using the field parent_id. I know the link works fine because I can see the children in the array.

Array
(
[0] => Array
    (
        [Job] => Array
            (
                [id] => 20
                [parent_id] => 0
                [rght] => 2
                [lft] => 1
                [client_id] => tasd
                [contact] => asdf
                [email] => sdf
                [address] => 
                [lat] => 
                [long] => 
                [user_id] => 1
                [request_type_id] => Electrical
                [date_start] => 0000-00-00 00:00:00
                [date_end] => 0000-00-00 00:00:00
                [date_complete] => 0000-00-00 00:00:00
                [date_closed] => 0000-00-00 00:00:00
                [status] => completed
                [brief_desc] => aasdf
                [desc] => asdfasdf
                [cost_est] => 3434.00
                [cost_actual] => 
                [created] => 2011-12-18 20:39:24
                    [modified] => 2011-12-18 20:39:24
            )


        [Children] => Array
            (
                [0] => Array
                    (
                        [id] => 21
                        [parent_id] => 20

Open in new window


I would like to display the child jobs under the parent jobs. Exactly how nested comments should work. Any would be great.

Is there a cake way of doing this? or some sort of sub foreach loop?

Thanks in advanced.
LVL 2
CurtinPropAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

liveaspankajCommented:
did you try this:

http://book.cakephp.org/view/1063/recursive

i guess recursive = 2 might do what you want.

If not, you might need to write a recursive function.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.