title: How to use symfony callback constraint with validation group in yaml?
body: <p>I'm using Symfony 2.6 and I'm following these tutorials how to use the validation callback constraint:</p>
  
  <p><a href="http://symfony.com/blog/new-in-symfony-2-4-a-better-callback-constraint" rel="nofollow noreferrer">http://symfony.com/blog/new-in-symfony-2-4-a-better-callback-constraint</a></p>
  
  <p><a href="http://symfony.com/doc/current/reference/constraints/Callback.html#external-callbacks-and-closures" rel="nofollow noreferrer">http://symfony.com/doc/current/reference/constraints/Callback.html#external-callbacks-and-closures</a></p>
  
  <p>To invoke an external validation call I'm trying to use following yaml configuration:</p>
  
  <pre><code>App\APIBundle\Entity\Order:
  properties:
      id:
          - Type:
              type: integer
              message: "Der Wert {{ value }} ist kein gültiger {{ type }}."
      amount:
          - Type:
              type: integer
              message: "Der Wert {{ value }} ist kein gültiger {{ type }}."
              groups: [ "AppOrder", "AppOrderbasket" ]
          - Callback: [App\APIBundle\Validator\Validator, validate]
              groups: [ "AppOrder", "AppOrderbasket" ]
  </code></pre>
  
  <p>I run into following problems when trying to validate the <strong>amount</strong> property with an <strong>external</strong> callback validation class:</p>
  
  <p>The function "validate" within the validation class App\APIBundle\Validator\Validator doesn't get invoked at all. I've tried to add validation groups by adding the "groups" property to the callback constraint. This seems not to be valid as i get this warning (Warning: trim() expects parameter 1 to be string, array given);</p>
  
  <p>If I remove the "groups" property the warning dissapears but the validator is still not invoked.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks in advance<br>
  ninsky</p>