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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:15:14+00:00 2026-05-27T00:15:14+00:00

I’d like some help from the community, if possible. We have a project at

  • 0

I’d like some help from the community, if possible.

We have a project at work, and time has come for refactoring. We are using PHP 5 and Propel 1.6 as ORM layer. The idea, actually, is pretty simple: we are trying to obtain all relevant information at the same time.

However, this information is not always directly related to the main class (or, in other words, to the main table). For example:

return (
$this->leftJoin( "IES.Pessoa mant" )
    ->leftJoin( "mant.Papel subpapel" )
        ->where( "subpapel.tipo = ?", Tipo_papel::IES )
        ->leftJoin( "subpapel.RelacionamentoRelatedByIdSubPapel relm" )
            ->where( "relm.tipo = ?", Tipo_relacionamento::MANTENEDORA_IES )
            ->leftJoin( "relm.PapelRelatedByIdSuperPapel superpapel" )
                ->leftJoinWith( "superpapel.Pessoa iesm" )
                ->where( 'superpapel.tipo = ?', Tipo_papel::MANTENEDORA_IES )
);

This is the code of a function in a ModelCriteria from our model layer. The idea is to obtain ‘iesm’ related to one ‘IES’.

But, here we have a problem. It happens that ‘IES’ is already related to one entity ‘Pessoa’. So, when this code is applied, this object will be lost, giving space to the entity ‘Pessoa’ related to ‘iesm’.

So the basic question is: I would like to set the property ‘iesm’ inside ‘IES’ object, and not Pessoa, which is set because of Propel mapping. That being said, how can I do that? Is it even possible? I’d like to set ‘iesm’ based on the alias created on leftJoinWith.

And another question, that showed immediately after this: if there is no direct relation in the database, how can I set this object, using the same idea? Trying to explain better: this ‘iesm’ is actually an object of type ‘Pessoa_juridica’. And ‘Pessoa_juridica’ is not directly related to ‘IES’. How could this ‘Pessoa_juridica’ be set inside ‘IES’ object?

I don’t even know if this is the best way of using it, so any other ideas are welcome. If you want further explanation, just let me know.

  • 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-27T00:15:15+00:00Added an answer on May 27, 2026 at 12:15 am

    Ok so i think i undestand what your are dealing with: You what to optimize database connections but found that, because you need to join two different unrelated table with another one that joins them in some way.

    My advise in this situation is:

    1. Try using UNION with a custom query. So create two criterions and use UNION to merge results, for this to work the selected fields en both tables should be the same in size and type. I’m no sure how to do this using the Query objets, but i’m quite sure it can be accomplished using Peer classes. Check this link UNION query with Propel ORM

    2. Dont hidrate all objets. Sometimes its far more efficient and quite more clear to use statements (like doSelectStmt()) and fetching information as arrays from separate database queries, manipulate them and then only hydrate the objects you are going to use.

    Remember that symfoyn also has a cache (APC for example), that’s always a good idea when dealing with really big tables, complex information and repeated information.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a text area in my form which accepts all possible characters from
I have some data like this: 1 2 3 4 5 9 2 6
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've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
I have a bunch of posts stored in text files formatted in yaml/textile (from
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.