/** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add($builder->create('type', ChoiceType::class, ['choices' => array_combine(array_map(function ($choice) use($options) { return $options['label_prefix'] . '.type.' . $choice; }, $choices = DateTimeType::getTypes()), $choices), 'choices_as_values' => true, 'xml_http_request_trigger' => true])->addEventSubscriber($this->dateTimeFilterSubscriber)); }
public function testTypes() { $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::TYPE_BETWEEN, DateTimeType::TYPE_NOT_BETWEEN, DateTimeType::TYPE_EMPTY, DateTimeType::TYPE_NOT_EMPTY], DateTimeType::getTypes()); }