title: Symfony 2: filtering x-to-many relations
body: <p>I have two entities that represent users (<code>User</code>) and friendship requests (<code>FriendshipRequest</code>). There is a oneToMany relationship between User and FriendshipRequest, so Doctrine creates a method that is called <code>getFriendshipRequests()</code> in the class User. This is ok, but FriendshipRequest has an attribute that is called status, so I would like that the User class could filter the friendship requests associated to it attending to their status. I have read Doctrine documentation, and I found out this:</p>
  
  <blockquote>
    <p>Natively you can’t filter associations in 2.0 and 2.1. You should use
    DQL queries to query for the filtered set of entities.</p>
  </blockquote>
  
  <p>According to this, I suppose that I should create a FriendshipRequest repository and create a method called "findByStatusAndUser" (or something like that), but I think that's a crappy solution.</p>
  
  <p>I would like to have a method in the User entity, like <code>getPendingStatusRequests()</code>. Is this possible? If it isn't, what would be the best solution?</p>