<p dir="auto">When using the 'groups' option to validate multiple groups at once, it would be great if I could find out which validations were triggered in every given group.</p>
<p dir="auto">This is how I do it currently:</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="  $warnings = $validator-&gt;validate($entity, array('warning'));
  $errors = $validator-&gt;validate($entity, array('error'));"><pre class="notranslate">  <span class="pl-s1"><span class="pl-c1">$</span>warnings</span> = <span class="pl-s1"><span class="pl-c1">$</span>validator</span>-&gt;<span class="pl-en">validate</span>(<span class="pl-s1"><span class="pl-c1">$</span>entity</span>, <span class="pl-en">array</span>(<span class="pl-s">'warning'</span>));
  <span class="pl-s1"><span class="pl-c1">$</span>errors</span> = <span class="pl-s1"><span class="pl-c1">$</span>validator</span>-&gt;<span class="pl-en">validate</span>(<span class="pl-s1"><span class="pl-c1">$</span>entity</span>, <span class="pl-en">array</span>(<span class="pl-s">'error'</span>));</pre></div>
<p dir="auto">A nicer way would be:</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="  $messages = $validator-&gt;validate($entity, array('warning', 'error'));"><pre class="notranslate">  <span class="pl-s1"><span class="pl-c1">$</span>messages</span> = <span class="pl-s1"><span class="pl-c1">$</span>validator</span>-&gt;<span class="pl-en">validate</span>(<span class="pl-s1"><span class="pl-c1">$</span>entity</span>, <span class="pl-en">array</span>(<span class="pl-s">'warning'</span>, <span class="pl-s">'error'</span>));</pre></div>
<p dir="auto">And then retreive the matched group or groups from the ConstraintViolation object with a <strong>getGroups()</strong> method.</p>
<p dir="auto">Maybe I missed something and this is currently possible. If so, please tell me how :-)</p>
<p dir="auto">Thanks.</p>
<p dir="auto">when you create a form by doing :<br>
createForm(new foo(), $object);<br>
with a "bar" form field defined in your foo FormType, the Symfony Form component is looking if one of the method getBar() , isBar() or hasBar() exists. If neither of this methods exists, an exception is thrown. This is a problem for object that use magical methods to simulate getBar() method for exemple.</p>