Doctrine : Lazy loading properties?

Try getSql() It is likely it is doing another query when you attempt to access a related field If you want to avoid that, don't access related fields!

Try ->getSql(). It is likely it is doing another query when you attempt to access a related field. If you want to avoid that, don't access related fields!

Yes, I have tried that and no, it doesn't load Attraction's. But I am able to access them via $property->Attraction . I would like some exception thrown so I can't make a mistake when I write a query.As I make really big programs, it is very easy to skip something like that.

– Zeljko Oct 22 '10 at 17:54 I believe you can access them because it triggers a new query, and it is therefore intended behaviour. I think the solution here is not the change the machine, but to pay more attention to how you use the machine. – Tom Oct 23 '10 at 9:40 Yes, but the idea is to prevent auto-fetching.

It is very easy to skip some join in quick-development of big programs. – Zeljko Oct 24 '10 at 11:51.

It looks like when I forget to put leftJoin in my queries, Doctrine will lazy-load relations after I pick them. I will still be able to access $property->Attraction , even if I didn't load them in this query. So I guess Doctrine does it internally by calling another 'SELECT'.

Is there a way to prevent this auto-loading by throwing some exception? This would help me create better and faster queries.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions