title: how to call function of entity repository in form type in symfony2
body: <p>i want to call function in form type class. function generate array and is written in entity repository class. using that array i will generate dynamic form field. 
  here is entity repository class function.</p>
  
  <pre><code>public static $roleNameMap = array(
              self::ROLE_SUPER_ADMIN =&gt; 'superAdmin',
              self::ROLE_MANAGEMEN =&gt; 'management',
              self::ROLE_MANAGERS =&gt; 'manager',
              self::ROLE_IT_STAFF =&gt; 'itStaff',
              self::ROLE_CS_CUSTOMER =&gt; 'csCustomer',
              self::ROLE_CS =&gt; 'cs',
              self::ROLE_DEALER =&gt; 'dealer',
              self::ROLE_ACCOUNT_STAFF =&gt; 'accountStaff',
              self::ROLE_BROKER_USER =&gt; 'staff',
      );
  
      public function getGroupListArray()
          {
              $qb = $this-&gt;createQueryBuilder('g')
                  -&gt;orderBy('g.hierarchy','ASC');
              $query = $qb-&gt;getQuery();
              $groupList = $query-&gt;execute();
              $roleNameMap = array();
              foreach ($groupList as $role){
                  $roleNameMap[$role-&gt;getId()] = $role-&gt;getRole();
              }
  
              return $roleNameMap;
          }
  </code></pre>
  
  <p>below is my form builder class where i want to call above entity repository function.</p>
  
  <pre><code>public function buildForm(FormBuilderInterface $builder, array $options) {
  
          $builder-&gt;add('routeId', 'hidden');
  
          foreach (GroupListRepository::$roleNameMap as $key=&gt;$value){
              $builder-&gt;add($value, 'checkbox',array('label' =&gt; '', 'required' =&gt; false,));
          }       
      }
  </code></pre>
  
  <p>i am able to get static variable as show in above code but, i have confusion that how should i access repository function in form builder class in symfony2.</p>
  
  <p>thanks in advance.         </p>