30/05/2015 - DOCTRINE
We have been investing plenty of personal time and energy for many years to share our knowledge with you all. However, we now need your help to keep this blog running. All you have to do is just click one of the adverts on the site, otherwise it will sadly be taken down due to hosting etc. costs. Thank you.
These are some facts about doctrine and the list will grow when time goes by. Note: If you're using symfony framework make sure you're using profiler bar because it gives us a lot of information about queries run.
createQueryBuilder()in repository classes if the targeted entity has associations with others because, depending on what you’re doing doctrine lazy load might kick in and run additional queries for associations later on so it is better to select all associations with
findmethods for fetching record(s) is better option since it uses slightly less memory and takes shorter to run.
createQueryBuilder()in repository class.
...->getQuery()...->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true)...->getResult();method to your query builder.
Query#iterate()in your QueryBuilder to avoid loading the whole result into memory at once. For more info, click here.