Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed ArrayFilterType issue and add support for multiple => false #2781

Merged
merged 1 commit into from
Jun 21, 2019

Conversation

yceruto
Copy link
Collaborator

@yceruto yceruto commented Jun 21, 2019

By default, this filter does not provide any choices list, they are dynamic (tags-style).
Now you can configure your own choices list for array filters:

easy_admin:
    entities:
        Products:
            # ...
            list:
                filters:
                    - property: 'fieldname'
                      type: 'array' # use this filter for `array`, `simple_array` and `json_array` types only.
                      type_options:
                          value_type_options:
                              multiple: true # or false
                              choices: { foo: 'foo', bar: 'bar' }
                              attr: { data-widget: 'select2' }

$queryBuilder->andWhere(\sprintf('%s.%s %s', $alias, $property, $data['comparison']));
} else {
$orX = new Expr\Orx();
foreach ($data['value'] as $value) {
$paramName = static::createAlias($property);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the bug I'm fixing here: each condition must have their own param name.

@yceruto yceruto self-assigned this Jun 21, 2019
@yceruto yceruto added this to the 2.x milestone Jun 21, 2019
@javiereguiluz
Copy link
Collaborator

Thanks Yonel for fixing this and adding the tests too. I'll update the docs later because I want to tweak some things for filters.

@javiereguiluz javiereguiluz merged commit 562995a into EasyCorp:master Jun 21, 2019
javiereguiluz added a commit that referenced this pull request Jun 21, 2019
… false (yceruto)

This PR was merged into the 2.0.x-dev branch.

Discussion
----------

Fixed ArrayFilterType issue and add support for multiple => false

By default, this filter does not provide any choices list, they are dynamic (tags-style).
Now you can configure your own choices list for array filters:
```yaml
easy_admin:
    entities:
        Products:
            # ...
            list:
                filters:
                    - property: 'fieldname'
                      type: 'array' # use this filter for `array`, `simple_array` and `json_array` types only.
                      type_options:
                          value_type_options:
                              multiple: true # or false
                              choices: { foo: 'foo', bar: 'bar' }
                              attr: { data-widget: 'select2' }
```

Commits
-------

562995a Fix ArrayFilterType and add support for multiple => false
@yceruto yceruto deleted the fix_array_filter branch June 21, 2019 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants