New Symfony 2.8 change: form field types are class names
See original GitHub issueHi there!
I ❤️ this plugin, and I usually if something isn’t up to date, it suddenly is a few days later!
For Symfony 2.8, the form types have changed from being a string (e.g. text
) to being a full class name:
// before
$builder->add('username', 'text');
// after
$builder->add('username', TextType::class);
In PhpStorm itself, the only unfortunate thing is that typing TextType
does not bring up the TextType
class as an auto-complete suggestion, because it has no static methods/constants/properties. So, you need to type TextType::class
, and then go back and “Import class” to add the use
statement. Ideally - if this is possible - it would auto-complete known classes that implement FormTypeInterface
in the project.
If I can help with this, I’d be happy to assist.
Thanks!
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
How to Create a Custom Form Field Type (Symfony 2.8 Docs)
Defining the Field Type. In order to create the custom field type, first you have to create the class representing the field. In...
Read more >How to Customize Form Rendering (Symfony 2.8 Docs)
The product portion of the field is the form name, which may be set manually or generated automatically based on your form type...
Read more >FormType Field (Symfony Docs)
Allows you to add a custom block name to the ones used by default to render the form type. Useful for example if...
Read more >How to Customize Form Rendering (Symfony Docs)
In this article you'll learn how to make single customizations to one or more fields of your forms. If you need to customize...
Read more >Forms (Symfony Docs)
Passing Options to Forms; Form Type Options; Changing the Action and HTTP Method; Changing the Form Name; Client-Side HTML Validation; Form Type Guessing ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry to open an older ticket, but the same is the case for other sitations:
from
inQueryBuilder
(probably other things too):Additionally the above, doesn’t provide further autocomplete:
EntityType::class
type in the optionclass
:EntityManager::getReference()
:OptionsResolver::setAllowedTypes
:Final one I could find is in doctrine queries themselves:
Aah damn, I was meant to raise a new issue with that as this one is closed. Totally forgot.