Skip to content

Commit 3d3fd47

Browse files
authored
Merge branch '5.x' into issue/7906
2 parents 8f5e17c + c6a8402 commit 3d3fd47

File tree

79 files changed

+831
-397
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+831
-397
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ permissions:
1616

1717
jobs:
1818
build:
19-
runs-on: ubuntu-latest
19+
runs-on: ubuntu-24.04
2020
strategy:
2121
matrix:
2222
doc-type: ['HTML', 'EPUB', 'PDF']
@@ -33,10 +33,10 @@ jobs:
3333
python -m pip install --upgrade pip
3434
pip install -r requirements.txt
3535
36-
- name: Install packages
37-
run: |
38-
sudo apt update
39-
sudo apt install texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended texlive-lang-all
36+
- uses: awalsh128/cache-apt-pkgs-action@v1
37+
with:
38+
packages: texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended texlive-lang-all
39+
version: ubuntu-24.04
4040

4141
- name: Build Docs
4242
run: |

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM debian:bookworm
22

3-
ENV DEBIAN_FRONTEND noninteractive
3+
ENV DEBIAN_FRONTEND=noninteractive
44

55
LABEL Description="This image is used to create an environment to contribute to the cakephp/docs"
66

config/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
epub_tocdepth = 2
113113

114114
rst_epilog = """
115-
.. |phpversion| replace:: **8.3**
115+
.. |phpversion| replace:: **8.4**
116116
.. |minphpversion| replace:: 8.1
117117
"""
118118

en/appendices.rst

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,10 @@ Appendices
44
Appendices contain information regarding the new features
55
introduced in each version and the migration path between versions.
66

7-
5.x Migration Guide
8-
===================
9-
10-
.. toctree::
11-
:maxdepth: 1
7+
Migration Guides
8+
================
129

13-
appendices/5-0-upgrade-guide
14-
appendices/5-0-migration-guide
15-
appendices/5-1-migration-guide
10+
:doc:`appendices/migration-guides`
1611

1712
Backwards Compatibility Shimming
1813
================================

en/appendices/5-0-migration-guide.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ Global
4747
Auth
4848
----
4949

50-
- `Auth` has been removed. Use the `cakephp/authentication <https://book.cakephp.org/authentication/2/en/index.html>`__ and
51-
`cakephp/authorization <https://book.cakephp.org/authorization/2/en/index.html>`__ plugins instead.
50+
- `Auth` has been removed. Use the `cakephp/authentication <https://book.cakephp.org/authentication/3/en/index.html>`__ and
51+
`cakephp/authorization <https://book.cakephp.org/authorization/3/en/index.html>`__ plugins instead.
5252

5353
Cache
5454
-----

en/appendices/5-2-migration-guide.rst

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
5.2 Migration Guide
2+
###################
3+
4+
The 5.2.0 release is a backwards compatible with 5.0. It adds new functionality
5+
and introduces new deprecations. Any functionality deprecated in 5.x will be
6+
removed in 6.0.0.
7+
8+
Behavior Changes
9+
================
10+
11+
- ``ValidationSet::add()`` will now raise errors when a rule is added with
12+
a name that is already defined. This change aims to prevent rules from being
13+
overwritten by accident.
14+
- ``Http\Session`` will now raise an exception when an invalid session preset is
15+
used.
16+
- ``FormProtectionComponent`` now raises ``Cake\Controller\Exception\FormProtectionException``. This
17+
class is a subclass of ``BadRequestException``, and offers the benefit of
18+
being filterable from logging.
19+
- ``NumericPaginator::paginate()`` now uses the ``finder`` option even when a ``SelectQuery`` instance is passed to it.
20+
21+
Deprecations
22+
============
23+
24+
Console
25+
-------
26+
27+
- ``Arguments::getMultipleOption()`` is deprecated. Use ``getArrayOption()``
28+
instead.
29+
30+
Datasource
31+
----------
32+
33+
- The ability to cast an ``EntityInterface`` instance to string has been deprecated.
34+
You should ``json_encode()`` the entity instead.
35+
36+
- Mass assigning multiple entity fields using ``EntityInterface::set()`` is deprecated.
37+
Use ``EntityInterface::patch()`` instead. For e.g. change usage like
38+
``$entity->set(['field1' => 'value1', 'field2' => 'value2'])`` to
39+
``$entity->patch(['field1' => 'value1', 'field2' => 'value2'])``.
40+
41+
Event
42+
-----
43+
44+
- Returning values from event listeners / callbacks is deprecated. Use ``$event->setResult()``
45+
instead or ``$event->stopPropogation()`` to just stop the event propogation.
46+
47+
View
48+
----
49+
50+
- The ``errorClass`` option of ``FormHelper`` has been deprecated in favour of
51+
using a template string. To upgrade move your ``errorClass`` definition to
52+
a template set. See :ref:`customizing-templates`.
53+
54+
55+
New Features
56+
============
57+
58+
Console
59+
-------
60+
61+
- The ``cake counter_cache`` command was added. This command can be used to
62+
regenerate counters for models that use ``CounterCacheBehavior``.
63+
- ``ConsoleIntegrationTestTrait::debugOutput()`` makes it easier to debug
64+
integration tests for console commands.
65+
- ``ConsoleInputArgument`` now supports a ``separator`` option. This option
66+
allows positional arguments to be delimited with a character sequence like
67+
``,``. CakePHP will split the positional argument into an array when arguments
68+
are parsed.
69+
- ``Arguments::getArrayArgumentAt()``, and ``Arguments::getArrayArgument()``
70+
were added. These methods allow you to read ``separator`` delimitered
71+
positional arguments as arrays.
72+
- ``ConsoleInputOption`` now supports a ``separator`` option. This option
73+
allows option values to be delimited with a character sequence like
74+
``,``. CakePHP will split the option value into an array when arguments
75+
are parsed.
76+
- ``Arguments::getArrayArgumentAt()``, ``Arguments::getArrayArgument()``, and
77+
``Arguments::getArrayOption()``
78+
were added. These methods allow you to read ``separator`` delimitered
79+
positional arguments as arrays.
80+
81+
Database
82+
--------
83+
84+
- The ``nativeuuid`` type was added. This type enables ``uuid`` columns to be
85+
used in Mysql connections with MariaDB. In all other drivers, ``nativeuuid``
86+
is an alias for ``uuid``.
87+
- ``Cake\Database\Type\JsonType::setDecodingOptions()`` was added. This method
88+
lets you define the value for the ``$flags`` argument of ``json_decode()``.
89+
- ``CounterCacheBehavior::updateCounterCache()`` was added. This method allows
90+
you to update the counter cache values for all records of the configured
91+
associations. ``CounterCacheCommand`` was also added to do the same through the
92+
console.
93+
- ``Cake\Database\Driver::quote()`` was added. This method provides a way to
94+
quote values to be used in SQL queries where prepared statements cannot be
95+
used.
96+
97+
Datasource
98+
----------
99+
100+
- Application rules can now use ``Closure`` to define the validation message.
101+
This allows you to create dynamic validation messages based on the entity
102+
state and validation rule options.
103+
104+
Error
105+
-----
106+
107+
- Custom exceptions can have specific error handling logic defined in
108+
``ErrorController``.
109+
110+
ORM
111+
---
112+
113+
- ``CounterCacheBehavior::updateCounterCache()`` has been added. This method
114+
allows you to update the counter cache values for all records of the configured
115+
associations.
116+
- ``BelongsToMany::setJunctionProperty()`` and ``getJunctionProperty()`` were
117+
added. These methods allow you to customize the ``_joinData`` property that is
118+
used to hydrate junction table records.
119+
- ``Table::findOrCreate()`` now accepts an array as second argument to directly pass data in.
120+
121+
TestSuite
122+
---------
123+
124+
- ``TestFixture::$strictFields`` was added. Enabling this property will make
125+
fixtures raise an error if a fixture's record list contains fields that do not
126+
exist in the schema.
127+
128+
View
129+
----
130+
131+
- ``FormHelper::deleteLink()`` has been added as convenience wrapper for delete links in
132+
templates using ``DELETE`` method.
133+
- ``HtmlHelper::importmap()`` was added. This method allows you to define
134+
import maps for your JavaScript files.
135+
- ``FormHelper`` now uses the ``containerClass`` template to apply a class to
136+
the form control div. The default value is ``input``.
137+

en/appendices/migration-guides.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ each version and the migration path between 5.x minor releases.
1010
./5-0-upgrade-guide
1111
./5-0-migration-guide
1212
./5-1-migration-guide
13+
./5-2-migration-guide
1314
./phpunit10

en/console-commands.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ CakePHP Provided Commands
145145

146146
console-commands/cache
147147
console-commands/completion
148+
console-commands/counter-cache
148149
console-commands/i18n
149150
console-commands/plugin
150151
console-commands/schema-cache

en/console-commands/commands.rst

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,6 @@ To get started testing your console application, create a test case that uses th
298298
``exec()`` that is used to execute your command. You can pass the same string
299299
you would use in the CLI to this method.
300300

301-
.. note::
302-
303-
For CakePHP 4.4 onwards the ``Cake\Console\TestSuite\ConsoleIntegrationTestTrait`` namespace should be used.
304-
305301
Let's start with a very simple command, located in
306302
**src/Command/UpdateTableCommand.php**::
307303

@@ -549,6 +545,20 @@ assertion methods that make help assert against console output::
549545
// assert that stderr matches a regular expression
550546
$this->assertErrorRegExp($expected);
551547

548+
Debug Helpers
549+
-------------
550+
551+
You can use ``debugOutput()`` to output the exit code, stdout and stderr of the
552+
last run command::
553+
554+
$this->exec('update_table Users');
555+
$this->assertExitCode(Command::CODE_SUCCESS);
556+
$this->debugOutput();
557+
558+
.. versionadded:: 4.2.0
559+
The ``debugOutput()`` method was added.
560+
561+
552562
Lifecycle Callbacks
553563
===================
554564

en/console-commands/counter-cache.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
CounterCache Tool
2+
#################
3+
4+
The CounterCacheCommand provides a CLI tool for rebuilding the counter caches
5+
in your application and plugin models. It can be used in maintenance and
6+
recovery operations, or to populate new counter caches added to your
7+
application.
8+
9+
.. code-block:: console
10+
11+
bin/cake counter_cache --assoc Comments Articles
12+
13+
This would rebuild the ``Comments`` related counters on the ``Articles`` table.
14+
For very large tables you may need to rebuild counters in batches. You can use
15+
the ``--limit`` and ``--page`` options to incrementally rebuild counter state.
16+
17+
.. code-block:: console
18+
19+
bin/cake counter_cache --assoc Comments --limit 100 --page 2 Articles
20+
21+
When ``limit`` and ``page`` are used, records will be ordered by the table's
22+
primary key.
23+
24+
.. versionadded:: 5.2.0

0 commit comments

Comments
 (0)