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
18 changes: 12 additions & 6 deletions en/appendices/5-3-migration-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ ORM
New Features
============

Cache
-----

- Added Redis Cluster support to ``RedisEngine``. Configure the ``cluster`` option
with an array of server addresses to enable cluster mode.

Command
-------

Expand All @@ -74,18 +80,18 @@ Command
- ``cake server`` now supports a ``--frankenphp`` option that will start the
development server with `FrankenPHP <https://frankenphp.dev/>`__.

Cache
-----

- Added Redis Cluster support to ``RedisEngine``. Configure the ``cluster`` option
with an array of server addresses to enable cluster mode.

Console
-------

- Added ``TreeHelper`` which outputs an array as a tree such as an array of filesystem
directories as array keys and files as lists under each directory.

Core
----

- Added ``Configure`` attribute to support injecting ``Configure`` values into
constructor arguments. See ref:`configure-dependency-injection`.

Database
--------

Expand Down
23 changes: 19 additions & 4 deletions en/development/dependency-injection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,28 @@ services like in a reporting system::
return new ReportAggregate($container->get('reports'));
});

.. _configure-dependency-injection:

Using Configuration Data
------------------------

Often you'll need configuration data in your services. While you could add
all the configuration keys your service needs into the container, that can be
tedious. To make configuration easier to work with CakePHP includes an
injectable configuration reader::
Often you'll need configuration data in your services. If you need a specific value,
you can inject it as a constructor argument using the ``Cake\Core\Attribute\Configure``
attribute::

use Cake\Core\Attribute\Configure;

class InjectedService
{
public function __construct(
#[Configure('MyService.apiKey')] protected string $apiKey,
) { }
}

.. versionadded:: 5.3.0

If you want to inject a copy of all configuration data, CakePHP includes
an injectable configuration reader::

use Cake\Core\ServiceConfig;

Expand Down