-
-
Notifications
You must be signed in to change notification settings - Fork 437
[FORM] Modify make:form to allow non-entities #301
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
Conversation
Before this modification the make:form command allowed passing a fully specified classname. It would generate a form with the correct bound class, but not read the fields. This also affects DTOs. This modification makes our lives easier by reading all fields of the bound class.
weaverryan
left a comment
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.
Nice improvement! And in such little code! Minor comments
src/Util/ClassDetails.php
Outdated
| $this->fullClassName = $fullClassName; | ||
| } | ||
|
|
||
| public function getProperties():? array |
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.
Make this private and move to the bottom. At least right now, we don't need this to be public.
src/Util/ClassDetails.php
Outdated
| return $propertiesList; | ||
| } | ||
|
|
||
| public function getFormFields() |
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.
: array return type
src/Util/ClassDetails.php
Outdated
|
|
||
| namespace Symfony\Bundle\MakerBundle\Util; | ||
|
|
||
| use Symfony\Bundle\MakerBundle\Str; |
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.
Not needed?
Make method private, Mark class as internal. Add DocComment to public method. Remove copied use statement.
|
Thank you @ckrack! This is an obvious, but wonderful improvement. Great work! |
This PR was merged into the 1.0-dev branch. Discussion ---------- Docs: improve make:form helper Add information about the second argument (bound-class). Give hints on using the bound-class with classes other than entities. Improves on #301 and fixes #477 Commits ------- 6a9b1c9 docs: improve make:form helper
Before this modification the make:form command allowed passing a fully specified classname.
It would generate a form with the correct bound class, but not read the fields.
It generated a form with one "field_name" field instead of something more useful.
This also affects DTOs.
This modification makes our lives easier by reading all fields of the bound class, except the id field.