title: Symfony validation: range between two numbers, OR a value
body: <p>I would like to validate a number to be between 10 and 20, or 30 and 40 or equal to 99.</p>
  
  <p>I could imagine the code to be something similar to this, but it does not work:</p>
  
  <p>In Entity\NameOfFile.php:</p>
  
  <pre><code>/*
   * @Assert\Range(
   *   min=10,
   *   max=20
   * )
   *
   * @Assert\Range(
   *  min=30,
   *  max=40
   * )
   *
   * @Assert\IdenticalTo(value = 99)
   */
   private $myVariable;
  </code></pre>
  
  <p>Or maybe something similar to this:</p>
  
  <pre><code> /*
    * @Assert\Choice({
    *  Range({min = 10, max = 20}),
    *  Range({min = 10, max = 20}), 
    *  99
    * )}
    */
    private $myVariable;
  </code></pre>
  
  <p>I also added min and max messages. </p>
  
  <p>In the first option, apparently only the first Assert is taken into consideration and the second one is ignored. The second option, does not work at all.</p>
  
  <p>Ps: Please, a solution without Regex</p>
  
  <p>EDIT: 
  Following the advice of M Khalid Juanid, the code looks like this:</p>
  
  <pre><code>/**
   * @Assert\Expression(
   *     "this.getmyVariable() in 10..20 or this.getmyVariable() in 30..40 or this.getmyVariable() == 99",
   *     message="Your error message", groups{"groupA"}
   * )
  *private $myVariable;
   */
  
    ***
  if($appendForm-&gt;isValid(array($groupA))
  {
  ***  
  }
  </code></pre>
  
  <p>It works fine, but only when the validation is not assigned to groupA. How can, the validation be assigned to a group, in this case?</p>