Skip to content

Commit 99c67e8

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.5
2 parents cb86efa + ad0fb2c commit 99c67e8

File tree

5 files changed

+33
-32
lines changed

5 files changed

+33
-32
lines changed

user_guide_src/source/incoming/routing.rst

+21-17
Original file line numberDiff line numberDiff line change
@@ -756,21 +756,22 @@ See :ref:`Auto Routing in Controllers <controller-auto-routing-improved>` for mo
756756
Configuration Options
757757
=====================
758758

759-
These options are available at the top of **app/Config/Routes.php**.
759+
These options are available in the **app/Config/Routing.php** file.
760760

761761
Default Controller
762762
------------------
763763

764764
For Site Root URI
765765
^^^^^^^^^^^^^^^^^
766766

767-
When a user visits the root of your site (i.e., **example.com**) the controller to use is determined by the value set by
768-
the ``setDefaultController()`` method, unless a route exists for it explicitly.
767+
When a user visits the root of your site (i.e., **example.com**) the controller
768+
to use is determined by the value set to the ``$defaultController`` property,
769+
unless a route exists for it explicitly.
769770

770-
The default value for this is ``Home``
771-
which matches the controller at **app/Controllers/Home.php**:
771+
The default value for this is ``Home`` which matches the controller at
772+
**app/Controllers/Home.php**::
772773

773-
.. literalinclude:: routing/047.php
774+
public string $defaultController = 'Home';
774775

775776
For Directory URI
776777
^^^^^^^^^^^^^^^^^
@@ -791,10 +792,10 @@ This works similar to the default controller setting, but is used to determine t
791792
when a controller is found that matches the URI, but no segment exists for the method. The default value is
792793
``index``.
793794

794-
In this example, if the user were to visit **example.com/products**, and a ``Products`` controller existed, the
795-
``Products::getListAll()`` method would be executed:
795+
In this example, if the user were to visit **example.com/products**, and a ``Products``
796+
controller existed, the ``Products::getListAll()`` method would be executed::
796797

797-
.. literalinclude:: routing/048.php
798+
public string $defaultMethod = 'listAll';
798799

799800
.. important:: You cannot access the controller with the URI of the default method name.
800801
In the example above, you can access **example.com/products**, but if you access **example.com/products/listall**, it will be not found.
@@ -884,19 +885,22 @@ See :ref:`Auto Routing (Legacy) in Controllers <controller-auto-routing-legacy>`
884885
Configuration Options (Legacy)
885886
==============================
886887

887-
These options are available at the top of **app/Config/Routes.php**.
888+
These options are available in the **app/Config/Routing.php** file.
888889

889890
Default Controller (Legacy)
890891
---------------------------
891892

892893
For Site Root URI (Legacy)
893894
^^^^^^^^^^^^^^^^^^^^^^^^^^
894895

895-
When a user visits the root of your site (i.e., example.com) the controller to use is determined by the value set by
896-
the ``setDefaultController()`` method, unless a route exists for it explicitly. The default value for this is ``Home``
897-
which matches the controller at **app/Controllers/Home.php**:
896+
When a user visits the root of your site (i.e., **example.com**) the controller
897+
to use is determined by the value set to the ``$defaultController`` property,
898+
unless a route exists for it explicitly.
898899

899-
.. literalinclude:: routing/047.php
900+
The default value for this is ``Home`` which matches the controller at
901+
**app/Controllers/Home.php**::
902+
903+
public string $defaultController = 'Home';
900904

901905
For Directory URI (Legacy)
902906
^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -914,10 +918,10 @@ This works similar to the default controller setting, but is used to determine t
914918
when a controller is found that matches the URI, but no segment exists for the method. The default value is
915919
``index``.
916920

917-
In this example, if the user were to visit **example.com/products**, and a ``Products`` controller existed, the
918-
``Products::listAll()`` method would be executed:
921+
In this example, if the user were to visit **example.com/products**, and a ``Products``
922+
controller existed, the ``Products::listAll()`` method would be executed::
919923

920-
.. literalinclude:: routing/048.php
924+
public string $defaultMethod = 'listAll';
921925

922926
Confirming Routes
923927
*****************

user_guide_src/source/incoming/routing/047.php

-4
This file was deleted.

user_guide_src/source/incoming/routing/048.php

-3
This file was deleted.

user_guide_src/source/libraries/validation.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ To try your form, visit your site using a URL similar to this one::
147147
example.com/index.php/form/
148148

149149
If you submit the form you should simply see the form reload. That's
150-
because you haven't set up any validation rules in ``$this->validate()`` yet.
150+
because you haven't set up any validation rules in :ref:`controller-validatedata` yet.
151151

152-
The ``validate()`` method is a method in the Controller. It uses
153-
the **Validation class** inside. See :ref:`controllers-validating-data`.
152+
The ``validateData()`` method is a method in the Controller. It uses
153+
the **Validation class** inside. See :ref:`controller-validatedata`.
154154

155-
.. note:: Since you haven't told the ``validate()`` method to validate anything
156-
yet, it **returns false** (boolean false) **by default**. The ``validate()``
155+
.. note:: Since you haven't told the ``validateData()`` method to validate anything
156+
yet, it **returns false** (boolean false) **by default**. The ``validateData()``
157157
method only returns true if it has successfully applied your rules without
158158
any of them failing.
159159

@@ -189,7 +189,7 @@ It loads the form helper used by your view files.
189189

190190
The controller has one method: ``index()``. This method returns
191191
the **signup** view to show the form when a non-POST request comes. Otherwise, it
192-
uses the Controller-provided ``validate()`` method. It also runs the validation routine.
192+
uses the Controller-provided :ref:`controller-validatedata` method. It also runs the validation routine.
193193
Based on whether the validation was successful it either presents the
194194
form or the success page.
195195

user_guide_src/source/libraries/validation/001.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ public function index()
1212
return view('signup');
1313
}
1414

15-
$rules = [];
15+
$rules = [
16+
// @TODO
17+
];
1618

17-
if (! $this->validate($rules)) {
19+
$data = $this->request->getPost(array_keys($rules));
20+
21+
if (! $this->validateData($data, $rules)) {
1822
return view('signup');
1923
}
2024

0 commit comments

Comments
 (0)