title: Symfony validation_groups how to get entity value
body: <p>In Symfony I want to validate a form dynamically. Depending on a value of an entity field I want to enable an validation group, in the case named "payed". I use the following code:</p>
  
  <pre><code>public function configureOptions(OptionsResolver $resolver)
  {
       $resolver-&gt;setDefaults(array(
          'data_class' =&gt; 'MyBundle\Entity\Account',
          'validation_groups' =&gt; function (FormInterface $form) {
  
              // Set always default
              $valarr = ['Default'];
  
              $business = $form-&gt;get('business')-&gt;getData();
              if($business == true) $valarr[] = "business";
  
              // This needs to be added in pending on entity field value
              if(???) $valarr[] = "payed";
  
              return $valarr;
          },
      ));
  }
  </code></pre>
  
  <p>How can I get my entity that is know in the controller where this form is activated into this function? For business it works as I can get the value from the form directly. </p>