title: Passing invididual field's "required" information to a compound Symfony2 form
body: <p>I need to enter a pair of date and time in multiple places of my Symfony2 application. To accomplish this, I've created a <code>custom_datetime</code> form type. I'd like to decide whether <code>time</code> is required by occassion, while keeping <code>date</code> required if the whole custom_datetime has a <code>required</code> flag.</p>
  
  <pre><code>class DateTime extends AbstractType
  {
  
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
              -&gt;add('date', 'text', [
                  'attr' =&gt; ['required' =&gt; true] // Here I maybe should inherit what is passed by the parent form
              ])
              -&gt;add('time', 'text', [
                  'attr' =&gt; ['required' =&gt; $options['time_required']]
              ])
          ;
      }
  
      public function setDefaultOptions(OptionsResolverInterface $resolver)
      {
          $resolver-&gt;setDefaults(array(
              'time_required' =&gt; false
          ));
      }
  
      public function getName()
      {
          return 'custom_datetime';
      }
  }
  </code></pre>
  
  <p>The <code>custom_datetime</code> is then by other forms. Currently I use it like this:</p>
  
  <pre><code>// date should be entered, time should not -- this does not currently work
  $builder-&gt;add('dt', 'custom_datetime', ['required' =&gt; true, 'time_required' =&gt; false]);
  // date + time should be entered
  $builder-&gt;add('dt', 'custom_datetime', ['required' =&gt; true, 'time_required' =&gt; true]);
  // neither of date or time is required
  $builder-&gt;add('dt', 'custom_datetime', ['required' =&gt; false]);
  </code></pre>
  
  <p>Unfortunately the <code>time</code> field gets the required attribute when rendered in HTML.</p>
  
  <p><strong>What should be done to allow the parent form of <code>custom_datetime</code> to pass "required" information about time field?</strong></p>