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

  • Home
  • SEARCH
  • 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 6165729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:13:00+00:00 2026-05-23T22:13:00+00:00

How can i searching in nested set, and recover the filtered data in tree

  • 0

How can i searching in nested set, and recover the filtered data in tree structure?

example:
root
|
cat1:

  • subcat1
  • subcat2
  • subcat3
    cat2:
  • subcateg1
  • subc2

I search the ‘subc2’.
root
|
cat2:

  • subc2

This is my fixtures for the test table:

FokonyviKategoria:
  fok0:
    megnevezes: Főkönyvi kategóriák
    children:
      fok1:
        megnevezes: Főkönyvi teszt 1
      fok2:
        megnevezes: Főkönyvi teszt 2
      fok3:
        megnevezes: Főkönyvi teszt 3
        children:
          fok4:
            megnevezes: Főkönyvi teszt 4
          fok5:
            megnevezes: Főkönyvi teszt 5

And the table definition:

FokonyviKategoria:
  actAs:
    NestedSet:
      hasManyRoots: false
  columns:
    megnevezes: string(255)
  relations:
    Szamlak:
      type: many
      local: id
      foreign: fokonyvi_kategoria_id
      foreignAlias: FokonyviKategoria

And this my attempt:

     $treeObject = Doctrine_Core::getTable('EszkozKategoria')->getTree();
           $q = Doctrine_Query::create()
                ->select('e.megnevezes')
                ->from('EszkozKategoria e')
                ->where('megnevezes LIKE "%fúró%"');
            $treeObject->setBaseQuery($q);
            $tree = $treeObject->fetchTree();
            $treeObject->resetBaseQuery();
            $query = $treeObject->getBaseQuery();
            $query->setHydrationMode(Doctrine_Core::HYDRATE_ARRAY_HIERARCHY);
            $treeObject->setBaseQuery($query);

            foreach ($tree as $node) {
                //$treeObject2 = Doctrine_Core::getTable('EszkozKategoria')->getTree();
                //$tmp = $treeObject2->fetchBranch($node->id, array('depth' => 3), Doctrine_Core::HYDRATE_ARRAY_HIERARCHY);
                //var_dump($tmp);
                //echo $node->getNode()->getPath(' / ', true) . "\n";
                $a = $node->getNode()->getAncestors();
                var_dump($a);
            }

I want the node(s), and all ancestors.

  • 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-05-23T22:13:00+00:00Added an answer on May 23, 2026 at 10:13 pm

    i would so:

    $listLeaf = FokonyviKategoriaTable::getInstance()->createQuery()
        ->where('level = ?', 2) //all leaf
        ->fetchArray();
    $list = array();
    foreach ($listLeaf as $id => $node) {
        $list[$node['id']] = $nade['megnevezes'];
        $list['ancestors'] = $node->getNode()->getAncestors();
    }
    return $list;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I optimize a Core Data query when searching for matching words in a
I've been searching for while now and I can't find a simple example of
This is a probably a no brainer, and I've been searching but can't seem
Can anone recommend a tool for searching my visual studio projects folders to find
I'm searching a wsgi middleware which I can warp around a wsgi applications and
You can get underground processes by ps ux I am searching a way to
I am searching for a web service which can record the actions done by
I've been searching for a library that can render organisation charts in either flash
I know I can do a find /replace by searching: Current Document Current Project
I've been searching for a library that can access multiple ssh connections at once,

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.