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

[RFC] [Form] custom choice loader article #6446

Closed
HeahDude opened this issue Apr 8, 2016 · 7 comments
Closed

[RFC] [Form] custom choice loader article #6446

HeahDude opened this issue Apr 8, 2016 · 7 comments
Milestone

Comments

@HeahDude
Copy link
Contributor

HeahDude commented Apr 8, 2016

Hey all,

I'm thinking about writing a short article pointing an example of a custom ChoiceLoaderInterface to optimize performances in form submission using a custom choice_value option.

I've some (maybe dumb) questions:

  • do you think it would be useful?

  • do you think it should be part of the doc?

  • can I host an article directly on GitHub, or should I handle a blog on my website?

    Thanks!

@xabbuh
Copy link
Member

xabbuh commented Apr 11, 2016

If we have a real use case that calls for custom implementation of the interface, I would be 👍 for adding an article to the docs.

@HeahDude
Copy link
Contributor Author

Currently the EntityType has an example in the introduction with users and a custom query builder ordering them by username.
We could use the same example, which implies to not use choice_value option so ids are used to load only selected users.
I propose some changes to the EntityType reference:

  1. in Basic Usage section, explicit the option multiple => true, since the fields is called "users" anyway
  2. mention that ids are used as choices values to optimize loading done in [Form] fixed EntityType choice options #6444
  3. add a link or a section following Using a Custom Query for the Entities, with a custom choice_name option to submit a username instead of an id through API, but needs a custom loader to optimize the query when loading the submitted values.
  4. maybe change the section Using Choices, to suggest using ChoiceType with loaded choices, and a transformer to return an ArrayCollection in model data (dealing with DataTransformer cookbook – strip_tags is a bad example? #6431 at the same time?).
  5. maybe keep using users instead of categories in the choice_label option example ?

@HeahDude
Copy link
Contributor Author

Ok I've updated previous post to take #6444 into account. I could maybe handle more there too.

@HeahDude
Copy link
Contributor Author

Maybe off topic but what about a UsersType in the SecurityBundle taking the user provider as argument and using it in a custom choice loader implementation ?

@carsonbot
Copy link
Collaborator

Thank you for this issue.
There has not been a lot of activity here for a while. Has this been resolved?

@carsonbot
Copy link
Collaborator

Friendly ping? Should this still be open? I will close if I don't hear anything.

@carsonbot
Copy link
Collaborator

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants