Skip to content

Commit f7a7ef2

Browse files
committed
Update docs for cakephp/cakephp#14246
1 parent 6a4b3ff commit f7a7ef2

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

en/appendices/4-1-migration-guide.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ View
5959
Behavior Changes
6060
================
6161

62+
While the following changes do not change the signature of any methods they do
63+
change the semantics or behavior of methods.
64+
6265
Database
6366
--------
6467

@@ -84,6 +87,16 @@ TestSuite
8487

8588
* ``TestCase::setAppNamespace()`` now returns the previous app namespace for easier save and restore.
8689

90+
View
91+
----
92+
93+
* ``FormHelper`` now has its default value sources set to ``data, context``
94+
instead of ``context``. If you use ``setValueSources()`` to changes the value
95+
sources you may need to update your code.
96+
* The ``FormHelper`` Context classes provided by CakePHP no longer take
97+
a ``$request`` object in their constructor anymore.
98+
99+
87100
New Features
88101
============
89102

en/views/helpers/form.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,21 @@ a following section. The built-in providers map to the following values of
4040
``$context``:
4141

4242
* An ``Entity`` instance or an iterator will map to
43-
`EntityContext <https://api.cakephp.org/3.x/class-Cake.View.Form.EntityContext.html>`_;
43+
`EntityContext
44+
<https://github.com/cakephp/cakephp/tree/master/src/View/Form/EntityContext.php>`_;
4445
this context class allows FormHelper to work with results from the
4546
built-in ORM.
4647

4748
* An array containing the ``'schema'`` key, will map to
48-
`ArrayContext <https://api.cakephp.org/3.x/class-Cake.View.Form.ArrayContext.html>`_
49+
`ArrayContext <https://github.com/cakephp/cakephp/tree/master/src/View/Form/ArrayContext.php>`_
4950
which allows you to create simple data structures to build forms against.
5051

5152
* ``null`` and ``false`` will map to
52-
`NullContext <https://api.cakephp.org/3.x/class-Cake.View.Form.NullContext.html>`_;
53+
`NullContext <https://github.com/cakephp/cakephp/tree/master/src/View/Form/NullContext.php>`_;
5354
this context class
5455
simply satisfies the interface FormHelper requires. This context is useful if
5556
you want to build a short form that doesn't require ORM persistence.
5657

57-
All context classes also have access to the request data, making it simpler to
58-
build forms.
59-
6058
Once a form has been created with a context, all controls you create will use the
6159
active context. In the case of an ORM backed form, FormHelper can access
6260
associated data, validation errors and schema metadata. You can close the active
@@ -177,7 +175,7 @@ contexts, such as ``EntityContext``, will fetch data from ``$request->getData()`
177175
or from the current entity.
178176

179177
If however, you are building a form that needs to read from the query string,
180-
you can use ``valueSource()`` to change where ``FormHelper`` reads data input
178+
you can use ``setValuesSource()`` to change where ``FormHelper`` reads data input
181179
data from::
182180

183181
// Prioritize query string over context:
@@ -201,7 +199,8 @@ The supported sources are ``context``, ``data`` and ``query``. You can use one
201199
or more sources. Any widgets generated by ``FormHelper`` will gather their
202200
values from the sources, in the order you setup.
203201

204-
The value sources will be reset to the default (``['context']``) when ``end()``
202+
The value sources will be reset to the default (``['data', 'context']``) when
203+
``end()``
205204
is called.
206205

207206
Changing the HTTP Method for a Form

0 commit comments

Comments
 (0)