Exemplo n.º 1
0
 /**
  * @param FormInterface $form
  * @param string|null   $data
  */
 private function buildForm(FormInterface $form, $data)
 {
     $form->remove('value')->remove('from')->remove('to');
     if ($data === null || in_array($data, DateTimeFilter::getSimpleTypes(), true)) {
         $form->add('value', $this->innerType);
     } elseif (in_array($data, DateTimeFilter::getCompoundTypes())) {
         $form->add('from', $this->innerType)->add('to', $this->innerType);
     }
 }
Exemplo n.º 2
0
 public function testCompoundTypes()
 {
     $this->assertSame([DateTimeType::TYPE_BETWEEN, DateTimeType::TYPE_NOT_BETWEEN], DateTimeType::getCompoundTypes());
 }