title: Add custom validator on unmapped field, but with context of whole form submission?
body: <p>tl;dr:</p>
  
  <ol>
  <li>I need a custom validation constraint to run on an unmapped form field</li>
  <li>I need the ID of the object the form is manipulating to eliminate it from consideration doing my validation constraint</li>
  <li>Attaching the validation to the form itself or the unmapped field doesn't give me enough context to run my validation query</li>
  </ol>
  
  <hr>
  
  <p>I have an unmapped field on my <code>Person</code> entity form that I need to run a validation on. I've followed <a href="http://knpuniversity.com/screencast/question-answer-day/custom-validation-property-path">this great article</a> on how to do this, but my use case is slightly different and not entirely covered by the article.</p>
  
  <p>I am making my own Unique Constraint that needs to run a custom query to determine the uniqueness. To run the query, I need access to the field value that was submitted, <em>as well as the original <code>Person</code> object (so I can get it's ID if it's an update operation)</em>. Without also having the that <code>Person</code> object I won't be able to eliminate it from consideration during the uniqueness query.</p>
  
  <p>If I apply the validator on the <code>PersonType</code> class like so:</p>
  
  <pre><code>public function setDefaultOptions(OptionsResolverInterface $resolver)
  {
      $resolver
          -&gt;setDefaults(array(
              'data_class' =&gt; 'CS\AcmeBundle\Entity\Person',
              'constraints' =&gt; array(
                  new MyUniqueValidator(),
              )
          ))
      ;
  }
  </code></pre>
  
  <p>Then the validator gets passed the entire <code>Person</code> object to perform the validation on. This doesn't help me, because the submitted form data is not persisted to the <code>Person</code> object (it's an unmapped field that I handle after <code>$form-&gt;isValid()</code> is called in the controller).</p>
  
  <p>If I apply the validator to the unmapped field directly instead:</p>
  
  <pre><code>    $builder
          -&gt;add('myUnmappedField', 'text', array(
              'mapped' =&gt; false,
              'constraints' =&gt; array(
                  new MyUniqueValidator(),
                )
              ),
          ))
  </code></pre>
  
  <p>Then the object I get passed to the validator is just the standalone form text, and nothing else. I don't have the ID <code>Person</code> object (if it was an update operation) to perform by uniqueness query.</p>
  
  <p>Hopefully I've explained this properly. Do I have any options to do this sort of validation gracefully?</p>