Skip to content

[Form] Collection: Reorganization of the lower part of the page #13454

Closed
@ThomasLandauer

Description

@ThomasLandauer

I'm suggesting to reorganize the page, starting at Allowing "new" Tags with the "Prototype"¶ https://symfony.com/doc/current/form/form_collections.html#allowing-new-tags-with-the-prototype

  • Merge the "add" and the "remove" sections. (Almost) anybody needing "add" will need "remove" too. And it just doesn't make sense to show a full code block again, just to explain another tiny adjustment needed for "remove". It's way easier to show it all at once, maybe with some inline comments like "this is only needed for removing tags"

  • Organize the two Doctrine boxes differently: Start with the most common relationship type. IMO this is "One-To-Many, Bidirectional" https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/reference/association-mapping.html#one-to-many-bidirectional . Then explain what's different if you're using one of the other relationship types.

  • Do not show a full JavaScript working example. Why? First, this makes it a nightmare to maintain. I tried some changes elsewhere, then realized the implications on the various JavaScript code blocks and got stuck: Changing the "jQuery" part #13450 (comment) That's probably the reason why this page hasn't changed for years - the code is so intertwined that nobody dares touching it.
    Second: It is so unlikely that anybody uses the exact same setup (jQuery with ul), that copy-pasting won't work anyway. And the Symfony docs are no JavaScript tutorial.
    Solution: Just show this single line (since it's the only part that's really demanded by Symfony), and explain the rest in comments or pseudo-code (or maybe some Fiddles):

    newForm = newForm.replace(/__name__/g, index);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions