-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Resolving $this usage outside a class on form.rst #7560
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
This commit take care of the framework use code examples only. The "Creating a simple Form" define the coding place to be into a controller action method. Unlikely, the documentation consider into the other examples that the reader will know the place of the sample code. This does not allow the examples to be standalone and can lead some disappointment for which one want to have informations about a single section. This commit offer to place the code samples into the default controller to create a logic use of the "$this" special variable.
$defaults = array( | ||
'dueDate' => new \DateTime('tomorrow'), | ||
); | ||
$form = $this->createFormBuilder($defaults) |
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.
Since this documents the component maybe $this->
should be replaced by FormFactory::
with the proper use statement instead of the current proposal. What do you think?
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.
Ah yes forgot about my comment, this is a good fix!
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.
Thanks for that PR 👍
$defaults = array( | ||
'dueDate' => new \DateTime('tomorrow'), | ||
); | ||
$form = $this->createFormBuilder($defaults) |
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.
Ah yes forgot about my comment, this is a good fix!
thx |
Thank you @matthieu88160. |
…eu88160) This PR was submitted for the 3.2 branch but it was merged into the 2.7 branch instead (closes #7560). Discussion ---------- Resolving $this usage outside a class on form.rst This commit take care of the framework use code examples only. The "Creating a simple Form" define the coding place to be into a controller action method. Unlikely, the documentation consider into the other examples that the reader will know the place of the sample code. This does not allow the examples to be standalone and can lead some disappointment for which one want to have informations about a single section. This commit offer to place the code samples into the default controller to create a logic use of the "$this" special variable. Commits ------- 8cf9cd2 Resolving $this usage outside a class on form.rst
* 2.7: (30 commits) [#7560] remove unused use statements Resolving $this usage outside a class on form.rst Fix some odd English in the PDOSessionHandler docs Fix typo Add the description for the HTTP status because it's not that common Update exception code status [#7592] some minor tweaks Fix link for Twig Extensions documentation Update framework.rst [Fix esi tag] Update render_without_controller.rst Update matchers.rst Update matchers.rst Update locale_sticky_session.rst Update framework.rst Update import.rst Update load_balancer_reverse_proxy.rst Moved the requirements file [#7509] add missing references Added a mention to APCu Polyfill in the performance article [#7497] minor rewording ...
This commit take care of the framework use code examples only.
The "Creating a simple Form" define the coding place to be into a controller action method. Unlikely, the documentation consider into the other examples that the reader will know the place of the sample code. This does not allow the examples to be standalone and can lead some disappointment for which one want to have informations about a single section.
This commit offer to place the code samples into the default controller to create a logic use of the "$this" special variable.