Skip to content

Commit

Permalink
docs: add user guide
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Feb 11, 2024
1 parent da455d4 commit a493db6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
2 changes: 2 additions & 0 deletions user_guide_src/source/changelogs/v4.5.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ Others
- **Autoloader:** The prefix ``\`` in the fully qualified classname returned by
``FileLocator::findQualifiedNameFromPath()`` has been removed.
- **BaseModel:** The ``getIdValue()`` method has been changed to ``abstract``.
- **Routing:** The :ref:`404-override` feature does change the Response status
code to 404 by default. See :ref:`Upgrading Guide <upgrade-450-404-override>`.

Interface Changes
=================
Expand Down
11 changes: 7 additions & 4 deletions user_guide_src/source/incoming/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,8 @@ to only those defined by you, by setting the ``$autoRoute`` property to false:
.. warning:: If you use the :doc:`CSRF protection </libraries/security>`, it does not protect **GET**
requests. If the URI is accessible by the GET method, the CSRF protection will not work.

.. _404-override:

404 Override
============

Expand All @@ -701,10 +703,11 @@ valid class/method pair, or a Closure:

.. literalinclude:: routing/069.php

.. note:: The 404 Override feature does not change the Response status code to ``404``.
If you don't set the status code in the controller you set, the default status code ``200``
will be returned. See :php:meth:`CodeIgniter\\HTTP\\Response::setStatusCode()` for
information on how to set the status code.
.. note:: Starting with v4.5.0, the 404 Override feature sets the Response status
code to ``404`` by default. In previous versions, the code was ``200``.
If you want to change the status code in the controller, see
:php:meth:`CodeIgniter\\HTTP\\Response::setStatusCode()` for information on
how to set the status code.

Route Processing by Priority
============================
Expand Down
27 changes: 23 additions & 4 deletions user_guide_src/source/installation/upgrade_450.rst
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,29 @@ using them, upgrade your code. See :ref:`ChangeLog <v450-removed-deprecated-item
Breaking Enhancements
*********************

- The method signatures of ``Validation::run()`` and ``ValidationInterface::run()``
have been changed. The ``?string`` typehint on the ``$dbGroup`` parameter was
removed. Extending classes should likewise remove the parameter so as not to
break LSP.
.. _upgrade-450-404-override:

404 Override Status Code
========================

In previous versions, :ref:`404-override` returned responses with the status code
``200`` by default. Now it returns ``404`` by default.

If you want ``200``, you need to set it in the controller::

$routes->set404Override(static function () {
response()->setStatusCode(200);

echo view('my_errors/not_found.html');
});

Validation::run() Signature
===========================

The method signatures of ``Validation::run()`` and ``ValidationInterface::run()``
have been changed. The ``?string`` typehint on the ``$dbGroup`` parameter was
removed. Extending classes should likewise remove the parameter so as not to
break LSP.

Project Files
*************
Expand Down

0 comments on commit a493db6

Please sign in to comment.