Skip to content

Commit

Permalink
Merge pull request #8253 from kenjis/docs-restful-controller-ns
Browse files Browse the repository at this point in the history
docs: fix incorrect sample code in restful.rst
  • Loading branch information
kenjis authored Nov 27, 2023
2 parents 645e93c + f55cb2e commit 35a8f74
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 6 deletions.
12 changes: 12 additions & 0 deletions user_guide_src/source/incoming/restful.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ the controller that should be used:

.. literalinclude:: restful/003.php

.. literalinclude:: restful/017.php

.. literalinclude:: restful/018.php

See also :ref:`controllers-namespace`.

Change the Placeholder Used
===========================

Expand Down Expand Up @@ -122,6 +128,12 @@ the controller that should be used:

.. literalinclude:: restful/011.php

.. literalinclude:: restful/019.php

.. literalinclude:: restful/020.php

See also :ref:`controllers-namespace`.

Change the Placeholder Used
===========================

Expand Down
5 changes: 2 additions & 3 deletions user_guide_src/source/incoming/restful/003.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

$routes->resource('photos', ['controller' => 'App\Gallery']);

$routes->resource('photos', ['controller' => 'Gallery']);
// Would create routes like:
$routes->get('photos', 'App\Gallery::index');
$routes->get('photos', '\App\Controllers\Gallery::index');
5 changes: 2 additions & 3 deletions user_guide_src/source/incoming/restful/011.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

$routes->presenter('photos', ['controller' => 'App\Gallery']);

$routes->presenter('photos', ['controller' => 'Gallery']);
// Would create routes like:
$routes->get('photos', 'App\Gallery::index');
$routes->get('photos', '\App\Controllers\Gallery::index');
5 changes: 5 additions & 0 deletions user_guide_src/source/incoming/restful/017.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

$routes->resource('photos', ['controller' => '\App\Gallery']);
// Would create routes like:
$routes->get('photos', '\App\Gallery::index');
7 changes: 7 additions & 0 deletions user_guide_src/source/incoming/restful/018.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

use App\Controllers\Gallery;

$routes->resource('photos', ['namespace' => '', 'controller' => Gallery::class]);
// Would create routes like:
$routes->get('photos', '\App\Controllers\Gallery::index');
5 changes: 5 additions & 0 deletions user_guide_src/source/incoming/restful/019.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

$routes->presenter('photos', ['controller' => '\App\Gallery']);
// Would create routes like:
$routes->get('photos', '\App\Gallery::index');
7 changes: 7 additions & 0 deletions user_guide_src/source/incoming/restful/020.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

use App\Controllers\Gallery;

$routes->presenter('photos', ['namespace' => '', 'controller' => Gallery::class]);
// Would create routes like:
$routes->get('photos', '\App\Controllers\Gallery::index');
2 changes: 2 additions & 0 deletions user_guide_src/source/incoming/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------------------

Expand Down

0 comments on commit 35a8f74

Please sign in to comment.