Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions en/appendices/3-5-migration-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ New Features
* ``Cake\Routing\Router::reverseToArray()`` was added. This method allow you to
convert a request object into an array that can be used to generate URL
strings.
* ``Cake\Routing\RouteBuilder::resources()`` had the ``path`` option
added. This option lets you make the resource path and controller name not
match.
* New abstract types were added for ``smallinteger`` and ``tinyinteger``.
Existing ``SMALLINT`` and ``TINYINT`` columns will now be reflected as these
new abstract types. ``TINYINT(1)`` columns will continue to be treated as
Expand Down
15 changes: 14 additions & 1 deletion en/development/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -942,14 +942,27 @@ You can specify an alternative inflection type using the ``inflect`` option::
]);
});

The above will generate URLs styled like: **/blog-posts/\***.
The above will generate URLs styled like: **/blog-posts**.

.. note::

As of CakePHP 3.1 the official app skeleton uses ``DashedRoute`` as its
default route class. Using the ``'inflect' => 'dasherize'`` option when
connecting resource routes is recommended for URL consistency.

Changing the Path Element
-------------------------

By default resource routes use an inflected form of the resource name for the
URL segment. You can set a custom URL segment with the ``path`` option::

Router::scope('/', function ($routes) {
$routes->resources('BlogPosts', ['path' => 'posts']);
});

.. versionadded:: 3.5.0
The ``path`` option was added in 3.5.0

.. index:: passed arguments
.. _passed-arguments:

Expand Down