title: Symfony - use voter in entityRepository
body: <p>My problem is this: I have a page /user which shows a list of all users. The page is visible only to those who are logged in and, depending on what kind of user the currently logged in user is, he sees only parts of the list. 
  I figured that a voter would be a good solution to this (if there's a better one please let me know), but I have a problem with supportsClass. 
  The userlist is a query in UserRepository named getAllUsers and I tried passing the securityContext to the repository so I can query if the current user has access or not. 
  My action looks like this: </p>
  
  <pre><code>    public function listAction($limit = 50, $offset = 0) {
          $manager = $this-&gt;getDoctrine()-&gt;getManager();
          $userRepository = $manager-&gt;getRepository('SeamUserBundle:User');
          $users = $userRepository-&gt;getAllUsers($this-&gt;get('security.context'));
          return ....
      }
  </code></pre>
  
  <p>and in userRepository I tried this: </p>
  
  <pre><code>public function getAllUsers($securityContext) {
      ....         
      if(!$securityContext-&gt;isGranted('USER_LIST_ALL', null)) {
         //modify query
      }
      ...
  }
  </code></pre>
  
  <p>but if I pass null as a second parameter to isGranted, the $class is now the Voter and therefore supportsClass returns false. 
  Am I doing this the wrong way? If so - how do I do this? If not - what's missing? How do I pass the user entity to isGranted? </p>
  
  <p>Thanks in advance. </p>