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

[NEW][Features] Added support override data of ChoiceType #383

Merged
merged 2 commits into from
Sep 19, 2017

Conversation

salkhwlani
Copy link
Contributor

sometimes maybe need to override choices the field with advanced logic, I know there is query_builder for Entity but its limit for a query & data from the database, but now can override data of all fields they base of ChoiceType field

Also, added simple test unit for this PR

example for using with Entity field

        $this->add('languages', 'entity', [
            'class' => 'App\Language',
            'data_override' => function ($choices, $field) {
                $choices['testID’] = 'test';
                return $choices;
            }
        ]);

sometimes maybe need to override choices the field with advanced logic, I know there is `query_builder` for `Entity` but its limit for a query & data from the database, but now can override data of all fields they base of `ChoiceType` field

Also, added simple test unit for this PR

example for using with `Entity` field

```
        $this->add('languages', 'entity', [
            'class' => 'App\Language',
            'data_override' => function ($choices, $field) {
                $choices['testID’] = 'test';
                return $choices;
            }
        ]);
```
@kristijanhusak
Copy link
Owner

Looks good, thanks!

@kristijanhusak kristijanhusak merged commit f7e2fef into kristijanhusak:master Sep 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants