title: Optimizing doctrine queries in Sonata Admin with LeftJoin
body: <p>How do you optimize the DB queries made by sonata admin in the list and edit views ?</p>
  
  <p>i LeftJoined some queries that i made using the querybuilder in my entity repository , this already helped a lot, brought my queries down from 100+ to about 22.</p>
  
  <p>But the remaining queries are the ones that happen automatically by using the formbuilder and listmapper. </p>
  
  <p>Is there anyway i can further optimize the queries made by those classes ?
  im not even sure at this point where the queries are made... i tried to overwrite the findBy, findAll methods of the repository but they seem to use something like</p>
  
  <pre><code>$persister = $this-&gt;_em-&gt;getUnitOfWork()-&gt;getEntityPersister($this-&gt;_entityName);
  return $persister-&gt;load($criteria, null, null, array(), 0, 1, $orderBy);
  </code></pre>
  
  <p>Not sure how i can add a join statement to that...</p>
  
  <p>And i guess it's not just in the sonata admin but also for queries that i use in the front-end that use the built-in EntityRepository find, findAll, findOneBy etc... functions.</p>