Skip to content

Make it more clear that form names need to be unique #4960

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

Closed
jakzal opened this issue Feb 4, 2015 · 7 comments
Closed

Make it more clear that form names need to be unique #4960

jakzal opened this issue Feb 4, 2015 · 7 comments

Comments

@jakzal
Copy link
Contributor

jakzal commented Feb 4, 2015

Currently, the docs say:

This new class contains all the directions needed to create the task form (note that the getName() method should return a unique identifier for this form "type").

I propose it's made more visible the name should be unique. It's no where verified, and might lead to unexpected problems (like symfony/symfony#13590).

@javiereguiluz
Copy link
Member

Do you really think that this is a documentation problem? I think that obscure problems like this should be reported using an exception thrown by the Form component.

@jakzal
Copy link
Contributor Author

jakzal commented Feb 4, 2015

I don't think it's trivial to solve in the code (ping @webmozart).

I agree it's not really user friendly at the moment. However, even if we solved it in the code, this is an important detail, which should be highlighted in the docs in my opinion.

@wouterj
Copy link
Member

wouterj commented Feb 4, 2015

It's already highlighted: "should return a unique identifier"

I don't think we can solve it better. Instead, I agree with @javiereguiluz, the code should have some validation for it to also help people who don't read the docs.

@jakzal
Copy link
Contributor Author

jakzal commented Feb 4, 2015

@wouterj it's not highlighted. It doesn't stand out visually ;) I agree we should do it in code too, but fixing docs is a quick win.

@Nek-
Copy link
Contributor

Nek- commented Feb 4, 2015

👍 i notice beginners like make many types that have same names. More than that, they name them like symfony types.

@stof
Copy link
Member

stof commented Feb 10, 2015

@wouterj allowing to overwrite a form type by registering a type again with this name is actually a feature.

weaverryan added a commit that referenced this issue Mar 24, 2015
…plication (javiereguiluz)

This PR was merged into the 2.3 branch.

Discussion
----------

Better explain that form types should be unique in the application

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | all
| Fixed tickets | #4960

Commits
-------

7a78532 Fixed a minor grammar issue
0eb149b Recommend app_ instead of app. as form type prefix
52a5551 Recommend a better way to standardize application form types
d47e751 Fixed syntax issues and provided more information
12b77af Better explain that form types should be unique in the application
@wouterj
Copy link
Member

wouterj commented May 8, 2015

Closing as #5076 added a caution, which is the most clear way of warning the user in the docs.

@wouterj wouterj closed this as completed May 8, 2015
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

No branches or pull requests

5 participants