tags:

views:

12

answers:

2

i learnt that in doctrine i can return partial objects. when i just do print_r() of the result set returned, they seem to still contain the definations for the fields, except that when i echo them out i get nth. so i guess the definations are there but the values are not. is this for performance? eg. in SQL i shld do SELECT field1, field2 instead of SELECT *?

A: 

I don't understand you question completely but in DQL you can do SELECT * since the ORM will always create a SELECT field1, field2,.... query out of it.

With regular SQL, you should avoid SELECTing * since it will decrease performance.

DrColossos
A: 

As far as I can tell, the ability to select just partial objects is, as you say, for performance. However, unless your table is very large, or contains columns with large sized data, I doubt there is a very large effect.

Doctrine can lazy-load the values in columns that are not selected when the object is first created. This can create performance problems, as Doctrine will perform more queries to get the missing data, so try to always make sure the data you use is selected.

Jani Hartikainen