Symfony form validation value is in array
<p>Currently I'm trying to figure out how to handle the form field validation of a TextType field in Symfony2's form builder context.</p>

<p>There is a field that should explicitly be filled manually with one of two possible values ([email=all], [email=test]). It's intended to be some security feature to assure that the user is definitely aware of what he's doing next. </p>

<p>I'm wondering if there is a validation constraint that can be used to validate the field's input value to fit one of the two known options. Either [email=all] or [email=test]. In plain PHP i would do like so</p>

<pre><code>function isValid($value){
    $options = array("[email=all]","[email=test]");
    return (in_array($value, $options)) ? true : false;
}
</code></pre>

<p>I'm aware that I'd build a custom validation constraint but maybe this could even be solved with Symfony standard constraints?</p>

<p>Thanks in advance!</p>