The ModelAutocompleteType is a duplicated class of ModelFilter with a different field_type.
VincentLanglet opened this issue · 0 comments
VincentLanglet commented
I took a look at #1040, I wanted to see what was missing to fix the issue ; so I looked at the difference between ModelFilter and ModelAutocompleteType.
- The filter method is the same
- The handle multiple method is the same, except that ModelFilter add the null check for NotEqual
- The handle single method is the same, except that ModelFilter add the null check for NotEqual
- The association method is the same, except that ModelFilter add a check about allowed values for mapping type
- ModelFilter has a private method getParentAlias needed for the null check
- ModelFilter has a
'mapping_type'
option. - ModelFilter has a
'field_type' => EntityType::class,
default option when ModelAutocompleteFilter useModelAutocompleteType
.
If we change NotEqual behavior to return null value too in ModelAutocompleteFilter, the differences 2, 3, 4, 5, 6 won't be.
So ModelAutocompleteFilter will be a duplicate of ModelFilter with just a config diff.
Should we then deprecate the ModelAutocompleteFilter, in favor of
->add('foo', ModelType::class, [
'field_type' => ModelAutocompleteType::class,
])
?