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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:22:04+00:00 2026-06-13T20:22:04+00:00

I have this basic model: When I fetch an entry from the book table

  • 0

I have this basic model:

enter image description here

When I fetch an entry from the book table and dump the output:

// no other Doctrine queries were made before this one:
$book = $em->getRepository('Entities\Book')->find(1);
var_dump($book);

I get the Book entity, but also, a proxied entity for Author:

object(Entities\Book)#179 (3) {
  ["id":"Entities\Book":private]=>
  int(1)
  ["title":"Entities\Book":private]=>
  string(7) "MyBook1"
  ["author":"Entities\Book":private]=>
  object(Doctrine\Proxy\__CG__\Entities\Author)#171 (5) {
  [...]  // many more lines of output

My understanding is that the proxied entity for Author is to be expected, because that is how Doctrine will lazy load information from the author table when I do $book->getAuthor().

Q1: Do you confirm that the presence of the proxied Author entity is expected at this stage?

However what strikes me, is that when I look at the var_dump output (which I’ve uploaded to pastebin for you to see), it contains more than 10,000 lines! Things I was not expecting to find include references to dummy_table1 and dummy_table2 which are not related to book or author in the model:

["dummy_table1"]=>    // line 1301
object(Doctrine\DBAL\Schema\Table)#194 (10) {

["dummy_table2"]=>   // line 1384
object(Doctrine\DBAL\Schema\Table)#191 (10) {

Q2: Is that expected as well?

From there I was wondering: if I want to store the information contained in $book in cache with serialize to be re-used later on in my views (I’m not talking about doing some operations with $book, just outputting some of the properties), it would be insane as I would store about 500KB for a book title, which brings me to this last question:

Q3: How do you cache the result of your Doctrine queries? Do you serialize the whole entities into cache, do you extract the information you need into an array and then store that array in cache, but if so, doesn’t it quickly become cumbersome…?

  • 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-13T20:22:05+00:00Added an answer on June 13, 2026 at 8:22 pm

    A1: Relations in entities are present at any time(You have written that You get the idea of lazy loading). The relation would be hydrated only when it’s demanded.

    A2: The huge var_dump data is normal for doctrine entities. Use Doctrine\Common\Util\Debug::dump($entity) instead.

    A3: Doctrine has his own caching mechanism for queries and results. I don’t think it would be inefficient if You query for the $book again. Furthermore DQL supports array hydration(returns an array rather than an entity).

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

Sidebar

Related Questions

this is a really basic question - I have a model called Book, which
I have this table, which can be seen as a basic custom gantt chart:
Hi I have this basic random quote script, but I would like it to
I have a js.erb with this basic content: $(#currencies).html(<%= options_for_select([['Dollar', '$']])%>); And the html
So I have this page that has some basic custom tabs: http://demo.unlockedmanagement.com/users/view/2 * NOTE
Basic C# syntax question: So I have this class public class BrandQuery<T> : Query<T>
i know this is basic but somehow i have been stuck here for some
I realize this is a basic question but I have searched online, been to
I'm a noob so this is probably basic stuff, but I have tried to
I am new to WCF so I think this is pretty basic. I have

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.