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 testSimpleTypes()
 {
     $this->assertSame([DateTimeType::TYPE_GREATER_THAN_OR_EQUALS, DateTimeType::TYPE_GREATER_THAN, DateTimeType::TYPE_LESS_THAN_OR_EQUALS, DateTimeType::TYPE_LESS_THAN, DateTimeType::TYPE_EQUALS, DateTimeType::TYPE_NOT_EQUALS], DateTimeType::getSimpleTypes());
 }