title: Symfony2 - validating multiple fields, DTO, no annotations
body: <p>I know that similar questions have been asked here on SO, but answers don't satisfy me. </p>
  
  <p>Having following:</p>
  
  <ol>
  <li>Standard form with fields <code>foo</code>, <code>bar</code>, <code>baz</code>, <code>bat</code>, <code>x</code></li>
  <li><code>DTO</code> (<strong>not entity</strong>, dummy object, <strong>no annotations</strong>)</li>
  <li>Constraints on some fields attached using <code>FormBuilder</code></li>
  <li>Form is used in multiple places.</li>
  </ol>
  
  <p>In some places that form is used, I would like to add single validator to fields <code>foo</code>, <code>bar</code>, <code>baz</code>. This validator can get only values of those fields or whole propagated DTO. It should have access to DI Container to call service that will check data against database.</p>
  
  <p>For now I'm thinking about one of two solutions:</p>
  
  <ol>
  <li>Adding extra constraint to the form in controllers that require it (sound dirty)</li>
  <li>Adding extra field to form constructor/DTO (not boolean but business logic that tells if extra validation is needed) and adding extra constraint to form. </li>
  </ol>
  
  <p>Problem is that I can't figure out how to handle either of those cases. </p>
  
  <p>Finally, I want to emphasize that I don't want to use validation groups and annotations - both will add extra dependencies and logic to DTO.</p>