-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[3.0] [Form] Added the new getBlockPrefix() method to the ResolvedFormTypeInterface #16200
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
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is wrong as ResolvedFormTypeInterface does not define a getBlockPrefix. So either the method must be added to that interface as well. Or the public method should be removed from ResolvedFormType. I don't see why we need that public method on the resolved type as one can access it easily through
getInnerType
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getName
was part of the ResolvedFormTypeInterface: https://github.com/symfony/form/blob/2.8/ResolvedFormTypeInterface.php#L23-L28 I think it makes much sense to makegetBlockPrefix
part of the interface in 3.0There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be removed. I don't see the point of having this method in the resolved type as it must equal the inner one. So overwriting it makes no sense either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if we remove it, we should do so in 2.8. @webmozart what is the point of having a
getBlockPrefix
on theResolvedFormType
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @webmozart
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's just merge this as is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add the method to ResolvedFormTypeInterface also to respect the LoD. The method is used in https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php#L80.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@webmozart why not simply call
$type->getInnerType()->getBlockPrefix()
there? It seems strange to me to offer two ways to do the same thing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @Tobion if that's the only reason to have this method in the interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My argument can be found in #16749. ResolvedFormType was always supposed to have all methods of FormType. getInnerType() exists for edge cases where you want to know by which actual class a form type is backed.