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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:29:15+00:00 2026-05-24T23:29:15+00:00

I’m working on a custom admin interface for managing sfGuardGroupPermission records, basically allowing the

  • 0

I’m working on a custom admin interface for managing sfGuardGroupPermission records, basically allowing the user to grant/remove permissions for all user groups across the system in one interface.

The query I’m using works fine when executed directly in the database, but when being executed and hydrated via Doctrine it seems to have most of its records stripped out.

Consider the following example:

  • I have one record in the sf_guard_group_permission table
  • I have 62 records in the sf_guard_permission table
  • I have 42 records in the sf_guard_group table

I am using a Doctrine_RawSql object to construct the query, this looks as follows:

$q->select('{p.*}, {gp.*}, {g.*}')
                ->from('sf_guard_permission p
                    LEFT OUTER JOIN sf_guard_group_permission gp ON p.id = gp.permission_id
                    LEFT OUTER JOIN sf_guard_group g ON g.id = gp.group_id')
                ->addComponent('gp', 'sfGuardGroupPermission gp')
                ->addComponent('p', 'gp.Permission p')
                ->addComponent('g', 'gp.Group g');

And if I get the raw sql using getSqlQuery() I get the following (which returns the correct result – a list of all permissions left joined by any groups that have these permissions…

SELECT gp.group_id AS gp__group_id, gp.permission_id AS gp__permission_id, gp.created_at AS gp__created_at, gp.updated_at AS gp__updated_at, p.id AS p__id, p.name AS p__name, p.description AS p__description, p.section_model_id AS p__section_model_id, p.created_at AS p__created_at, p.updated_at AS p__updated_at, g.id AS g__id, g.name AS g__name, g.description AS g__description, g.created_at AS g__created_at, g.updated_at AS g__updated_at 
    FROM sf_guard_permission p 
    LEFT OUTER JOIN sf_guard_group_permission gp 
         ON p.id = gp.permission_id 
    LEFT OUTER JOIN sf_guard_group g 
         ON g.id = gp.group_id

When I run the query through doctrine and var_dump my resulting Doctrine_Collection, I am only given 2 records. The first record corresponds with the sf_guard_group_permission record I have in my table (correct), the second record has a group_id of null, but contains some valid sf_guard_permission information. It seems a bit strange.

Can someone maybe suggest where I’m going wrong?

  • 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-24T23:29:16+00:00Added an answer on May 24, 2026 at 11:29 pm

    For anyone else needing this… I just had my query wrong:

    $q = Doctrine_Query::create()
            ->from('sfGuardPermission p')
            ->leftJoin('p.sfGuardGroupPermission gp')
            ->leftJoin('gp.Group g')
            ->leftJoin('p.sfGuardSectionModel sm');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I have a text area in my form which accepts all possible characters from
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.