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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:36:04+00:00 2026-05-23T21:36:04+00:00

I am currently in the process of porting a recent symfony 1.4 application to

  • 0

I am currently in the process of porting a recent symfony 1.4 application to Symfony2 and Doctrine2. The first thing I noticed once I converted the mapping information (we use YAML files), is that querying for user objects got into an infinite loop.
I played around with the associations and found that I had a cyclical one. I removed that one for debugging purposes, wondering why it would cycle through all those associations at all. I had just asked for all users.

Today I came across the same problem again with another object, only that it stopped after 930 queries and didn’t feature an endless loop. It seems that Doctrine2, when it populates the object, queries all objects for each association. No proxying, no lazy loading.

I enabled fetch: LAZY on that assocation and voilà, the auto-population stopped!
But now I want to have that as the default behavior, as the model has over 50 associations and I don’t want to have to add this line to all of them.

How do I activate lazy loading as the default in Doctrine 2?

  • 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-23T21:36:04+00:00Added an answer on May 23, 2026 at 9:36 pm

    After much sweat and reducing the model to a minimal example, I found out why Doctrine fetches all these multiple rows.

    The culprit was the ORM tool I am using. When it imported the existing database structure, every relationship was deemed a “one-to-one” relationship. Changing the relationship to “one-to-many” on all 85 associations (as would be correct) should do did the trick.

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

Sidebar

Related Questions

I am currently in the process of porting game code from PC to flash,
I'm currently in the process of writing a steganography application with Qt. I am
I'm currently in the process of creating a Silverlight 3 data driven application. To
I'm in the process of porting a Windows application to OS X (we wrote
I'm currently in the process of writing my first Rails app. I'm writing a
I'm in the process of porting an application from Windows to Mac OS X.
I am currently in process of porting one of my java applet games to
I'm porting an application written in R that currently runs under Windows over to
I am currently in the process of porting one of my Qt programs from
I am in the process of porting an existing application to run on Windows

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.