title: Using one class Voter for many entities
body: <p>This is the function <strong>supportsClass</strong> in class Voter</p>
  
  <p><a href="http://symfony.com/doc/2.5/cookbook/security/voters_data_permission.html" rel="nofollow">http://symfony.com/doc/2.5/cookbook/security/voters_data_permission.html</a></p>
  
  <pre><code> public function supportsClass($class)
  {
      $supportedClass = 'AppBundle\Entity\Post';
  
      return $supportedClass === $class || is_subclass_of($class, $supportedClass);
  }
  </code></pre>
  
  <p>I'd like to know if it is possible to use one class voter for many entities in the same bundle or I have to create a Voter for each entity ?</p>
  
  <p><strong>EDIT</strong>
  I have found this solution:</p>
  
  <pre><code> public function supportsClass($class)
  {
      $classes = array(
          'Project\AgenceBundle\Entity\Agence',
          'Project\AgenceBundle\Entity\SubAgence',
          'Project\AgenceBundle\Entity\Subscription'
      );
      $ok = false;
      foreach($classes as $supportedClass)
      $ok = $ok || $supportedClass === $class || is_subclass_of($class, $supportedClass);
  
      return $ok;
  }
  </code></pre>