Symfony 2 fetching data using getRepository() and DQL

Hi folks,

Happy New Year !!!

Sorry I have been really busy past few months. I always wanted to continue my blog but the amount of workload I had to go through was immense. Fortunately, I found sometime to come up with a new post.

Well, this brief post is about the impact on fetching data mainly using getRepository and DQL (Doctrine Query Language), which you might have already known before. But I took some time out to highlight this fact, mainly for developers who are new to Symfony 2.x & Doctrine 2.x., which can heavily impact on performance on your Symfony application in long run.

Imagine you have 3 tables which are ‘users’, ‘user_roles’ and ‘user_categories’. There are unidirectional many-to-one relationships between ‘users’ to ‘user_roles’ and ‘user_roles’ to ‘user_categories’. Refer to Users.orm, UserRoles.orm and UserCategories.orm files below.

Continue reading

Share