title: How to use closures in validation component in Symfony2?
body: <p>Would you share with me an example how to use closures in validation component in Symfony2?</p>
  
  <p>I use this code to validate $prop:</p>
  
  <pre><code>use Symfony\Component\Validator\Constraints as Assert;
  
  class A
  {
      /**
       * @Assert\NotBlank()
       * @Assert\Choice(choices = {"value1", "value2"})
       */
      private $prop;
  }
  </code></pre>
  
  <p>I want to use closure here as shown in <a href="http://symfony.com/doc/current/reference/constraints/Choice.html#callback" rel="nofollow">documentation</a> with "callback" option. I've googled for a while but haven't found any examples yet.</p>