Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8778425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:32:08+00:00 2026-06-13T19:32:08+00:00

I am using the tree behavior and when I query via ->find(‘threaded’, …) –

  • 0

I am using the tree behavior and when I query via ->find(‘threaded’, …) – as expected – I get the tree back.

But I want additional joins happen, so something like:

$data = $this->Category->find('threaded', array(
    'joins' => array(
        array('table' => 'videos',
            'alias' => 'Video',
            'type' => 'LEFT',
            'conditions' => array(
                'Category.id = Video.category_id',
            )
        )
    )
));

Category hasMany Video, but Video is not a tree, just related.

Can I use the threaded query for that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:32:09+00:00Added an answer on June 13, 2026 at 7:32 pm

    To produce the “threaded” output Cake 1) calls a find(‘all), then 2) puts the resulting array through Set::nest() function.

    So just get your output using a standard find + your custom joins, then just use the Set::nest

    (NB: Hash has replaced Set in Cake 2, but Cake still uses Set internally. Both will work for now. Hash::nest )

    So if you take a look at Cake’s model.php, the nest function is called like so:

    return Set::nest($results, array(
                'idPath' => '/' . $this->alias . '/' . $this->primaryKey,
                'parentPath' => '/' . $this->alias . '/' . $parent
            ));
    

    Use that as a template for your call. For your data it would look something like:

    return Set::nest($results, array(
                'idPath' => '/Category/id',
                'parentPath' => '/Category/parent_id'           ));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Ruby on Rails 3.0.7 and I have tree classes what behavior
I am attempting to create a behavior tree using C#. For anyone who doesn't
I am creating a file tree using PHP & jQuery, but I'm having trouble
I am using DoctrineExtensions for managing a nested tree(nested tree behavior). I have to
When using NERD Tree on MacVim, I can open a file in a new
I'm using jqgrid tree grid with the following configuration colModel : [ { name:'id',width
I've been using seesaw.tree/simple-tree-model to create my TreeModels, the docs say that this is
I have to build a tree using the following data which comes from a
Problem: I am trying to build a recursive tree using a function and data
It is very straight-forward to plot a tree using igraph in R library(igraph) plot(graph.tree(20,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.