Skip to content

Conversation

matthieu88160
Copy link
Contributor

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.

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)
Copy link
Contributor

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?

Copy link
Contributor

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!

Copy link
Contributor

@HeahDude HeahDude left a 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)
Copy link
Contributor

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!

@matthieu88160
Copy link
Contributor Author

thx

@xabbuh
Copy link
Member

xabbuh commented Mar 13, 2017

Thank you @matthieu88160.

xabbuh added a commit that referenced this pull request Mar 13, 2017
…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
xabbuh added a commit that referenced this pull request Mar 13, 2017
xabbuh added a commit that referenced this pull request Mar 13, 2017
* 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 ...
@xabbuh xabbuh closed this Mar 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

4 participants