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 8026135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:23:20+00:00 2026-06-04T23:23:20+00:00

I am having nested-set (using Gedmo tree) entity called Location. Entity Appartment has location_id

  • 0

I am having nested-set (using Gedmo tree) entity called “Location”. Entity “Appartment” has location_id and what I need to do it to map scalar value called eg “path” to query that returns all appartments.

In Doctrine1, I had this code:

/**
* Add "path" to each element
* 
* @param Doctrine_Query $query
* @param string $separator
*/
protected function addScalar_path(Doctrine_Query $query, $separator=", ")
{
    $subquery = "k99.root_id=o.root_id AND k99.lft<=o.lft AND k99.rgt>=o.rgt AND k99.level<=o.level" ;

    $query->addSelect("(SELECT GROUP_CONCAT(k99.name ORDER BY k99.level SEPARATOR '$separator') FROM Location k99 WHERE $subquery) AS path") ;
}

Note: “o” alias is used for primary query.
This code would allow me to use

{foreach .... as $appartment}
   {$appartment->path}
...

Which would print:

Australia, Victoria, Melbourne, ...other children...

How to do the same thing in D2? And how to even include doctrine extenstions in my symfony2 project?

  • 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-04T23:23:22+00:00Added an answer on June 4, 2026 at 11:23 pm

    If you want to use it in QueryBuilder you must :

    1) add DQL functions GroupConcat: GroupConcat

    2 ) Registering GroupConcat :DQL User Defined Functions

    another alternative is to use NativeQuery :Native SQL


    In symfony2 registering a function DQL it’s very simple just add GROUP_CONCAT in config.yml like:

        entity_managers:
            default:
                dql:
                    string_functions:
                        GROUP_CONCAT: YourBundle\Query\Mysql\GroupConcat
    

    For more information visit Registering Custom DQL Functions

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble using nested ajax calls with selectors. I have a section
I'm having an issue accessing some nested data in an XML response using Perl/XML::Simple.
I am using a nested set model and want to be able to select
I am using the nested set model to store a large hierarchy of data
I am having some issues with nested models in a form, using Rails 3.1rc4.
I have a UL nested inside a DIV, with the DIV having padding set
Having issues referencing $(this) from within a the nested ajax 'success' function... I know
i'm having some problems with C++ and nested classes. For example: in main.cpp int
I am having some trouble creating a nested association and I can't quite spot
I'm having a problem with nested model forms that contain radio buttons, when I

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.