3

Possible Duplicate:
Too much data with var_dump in symfony2 doctrine2

I have quite simple entities that are related to each other, something like a User entity having one Profile and having many Pictures and many Addresses, etc. Nothing too fancy, and everything is working great.

But my problem is: If I try to do a simple

 print_r($this->user); die();

in the controller, my browser will basically crash, obviously because there is too much data to display. So, should I be worried ? I feel like my associations might be wrong somewhere...

If it is a normal behaviour of Symfony, should I still be worried about all this data being in memory ?

Community
  • 1
  • 1
  • At least, it would be good to know if I am alone in this situation... – marconalida Nov 19 '12 at 13:17
  • Indeed, it is the same problem, but doesn't answer the memory part. – marconalida Nov 19 '12 at 13:33
  • 1
    It answers, you should use built-in `dump` function and you'll see that it's not as awful as it looks with `print_r`. For memory usage you have your requirements and symfony's profiler. In general you don't need to worry about it. Your browser crashes because you're trying to dump the entity manager which an entity with relations may have a reference to. – meze Nov 19 '12 at 13:42
  • Another thing you can do is to use the `getArrayResult()` method so that your results are only partial entities. Of course, this may not give all the information you need. – Squazic Nov 19 '12 at 15:10

0 Answers0