From 11afcc215202c6ba3c80f9553ecdfb3fb5929d54 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 25 Nov 2023 19:58:32 +0900 Subject: [PATCH] docs: fix incorrect sample code --- user_guide_src/source/incoming/restful.rst | 4 ++++ user_guide_src/source/incoming/restful/003.php | 7 +++++-- user_guide_src/source/incoming/restful/011.php | 7 +++++-- user_guide_src/source/incoming/routing.rst | 2 ++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/incoming/restful.rst b/user_guide_src/source/incoming/restful.rst index 9240ac8b476d..d40f27ff6e9f 100644 --- a/user_guide_src/source/incoming/restful.rst +++ b/user_guide_src/source/incoming/restful.rst @@ -52,6 +52,8 @@ the controller that should be used: .. literalinclude:: restful/003.php +See also :ref:`controllers-namespace`. + Change the Placeholder Used =========================== @@ -122,6 +124,8 @@ the controller that should be used: .. literalinclude:: restful/011.php +See also :ref:`controllers-namespace`. + Change the Placeholder Used =========================== diff --git a/user_guide_src/source/incoming/restful/003.php b/user_guide_src/source/incoming/restful/003.php index 6610555f0a5f..347fde94c649 100644 --- a/user_guide_src/source/incoming/restful/003.php +++ b/user_guide_src/source/incoming/restful/003.php @@ -1,6 +1,9 @@ resource('photos', ['controller' => 'App\Gallery']); +$routes->resource('photos', ['controller' => 'Gallery']); +// Would create routes like: +$routes->get('photos', '\App\Controllers\Gallery::index'); +$routes->resource('photos', ['controller' => '\App\Gallery']); // Would create routes like: -$routes->get('photos', 'App\Gallery::index'); +$routes->get('photos', '\App\Gallery::index'); diff --git a/user_guide_src/source/incoming/restful/011.php b/user_guide_src/source/incoming/restful/011.php index cbb6f13bdf85..fc3a44b14229 100644 --- a/user_guide_src/source/incoming/restful/011.php +++ b/user_guide_src/source/incoming/restful/011.php @@ -1,6 +1,9 @@ presenter('photos', ['controller' => 'App\Gallery']); +$routes->presenter('photos', ['controller' => 'Gallery']); +// Would create routes like: +$routes->get('photos', '\App\Controllers\Gallery::index'); +$routes->presenter('photos', ['controller' => '\App\Gallery']); // Would create routes like: -$routes->get('photos', 'App\Gallery::index'); +$routes->get('photos', '\App\Gallery::index'); diff --git a/user_guide_src/source/incoming/routing.rst b/user_guide_src/source/incoming/routing.rst index c509f807be87..646b66bd4ffc 100644 --- a/user_guide_src/source/incoming/routing.rst +++ b/user_guide_src/source/incoming/routing.rst @@ -83,6 +83,8 @@ You can supply multiple verbs that a route should match by passing them in as an Specifying Route Handlers ========================= +.. _controllers-namespace: + Controller's Namespace ----------------------