title: symfony 2.8: Invalid argument supplied for foreach() into Constraints/FormValidator
body: <p>Using silex 2.0 and symfony 2.8 form component (not sf2 full stack), I have a form with several fields and an embed form.</p>
  
  <p>When submitting the form, I got an error:</p>
  
  <pre><code>Warning: Invalid argument supplied for foreach() in vendor/symfony/form/Extension/Validator/Constraints/FormValidator.php on line 66
  </code></pre>
  
  <p>No constraints have been set to any fields and form however, in FormValidator.php, when executing <code>$config-&gt;getOption('constraints')</code>, it returns an <strong>empty array for fields</strong> but <strong><code>NULL</code> for the embed form</strong>.</p>
  
  <p>Should the constraints also be set as empty array for embed form? If we have to set it manually, where should I do it?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>class DebugPreviewChannelForm extends AbstractType
  {
      public function __construct(FormFactoryInterface $formFactory)
      {
          $this-&gt;formFactory = $formFactory;
      }
  
      public function build(array $data, array $apps)
      {
            $builder = $this-&gt;formFactory-&gt;createBuilder(FormType::class, $data);
  
            $builder-&gt;add(
              'applicationId',
              ChoiceType::class,
              [
                  'choices' =&gt; $apps,
                  'label' =&gt; 'Application',
                  'choices_as_values' =&gt; true,
              ]
           )
           -&gt;add('user', UserType::class);
  
           return $builder-&gt;getForm();
      }
  }
  
  class UserType extends FormType implements DataMapperInterface
  {
     public function buildForm(FormBuilderInterface $builder, array $options)
     {
          $builder
              -&gt;setCompound(true)
              -&gt;setDataMapper($this)
              -&gt;add(
                  'hash',
                  TextType::class,
                  ['required' =&gt; false]
              );
      }
  }
  </code></pre>
  
  <p>If I remove <code>-&gt;add('user', UserType::class)</code>, it works perfectly.</p>