/** * @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); } }
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()); }