title: Symfony best practices. Should queries be in repositories or services?
body: <p>I have a question about best practices in Symfony 2. Sorry if it's a bit vague and subjective. I guess I can sum up my question as:</p>
  
  <p>"Are repositories always the right place for queries?".</p>
  
  <p>Right now I'm putting most of my doctrine queries in entity repositories. Most of my controller actions do typical things like query for an entity or collection of entities, throw an exception or redirect depending on the outcome of that, otherwise update one or more entities. Most actions are more complex than can be done efficiently with the standard ->find, ->findBy etc queries. Most require joins. When a query involves multiple entities, sometimes I'm not sure which repository it should even go in. I guess there is the root entity of the query but ... sometimes data from the joined entities are more important and relevant so it feels wrong to put it in the root entity's repository.</p>
  
  <p>That's working okay but I tend to end up with lots of almost the same but slightly different queries in my repositories. Coming up with names and keeping track of exactly what each one does can get confusing and tedious. Most of these queries are used by only one or two (often seldom used) controller actions in the same controller. I feel like I'm cluttering my repositories with too much specialized, seldom used stuff.</p>
  
  <p>It seems like all but the most simple actions should be encapsulated in an object or service. So, I've started doing a lot of my queries directly in the service rather than a repository. It's easy to look at the action all in one place.  Is this an okay practice?</p>