File tree Expand file tree Collapse file tree 2 files changed +31
-10
lines changed Expand file tree Collapse file tree 2 files changed +31
-10
lines changed Original file line number Diff line number Diff line change 65
65
New Features
66
66
============
67
67
68
+ Cache
69
+ -----
70
+
71
+ - Added Redis Cluster support to ``RedisEngine ``. Configure the ``cluster `` option
72
+ with an array of server addresses to enable cluster mode.
73
+
68
74
Command
69
75
-------
70
76
@@ -74,18 +80,18 @@ Command
74
80
- ``cake server `` now supports a ``--frankenphp `` option that will start the
75
81
development server with `FrankenPHP <https://frankenphp.dev/ >`__.
76
82
77
- Cache
78
- -----
79
-
80
- - Added Redis Cluster support to ``RedisEngine ``. Configure the ``cluster `` option
81
- with an array of server addresses to enable cluster mode.
82
-
83
83
Console
84
84
-------
85
85
86
86
- Added ``TreeHelper `` which outputs an array as a tree such as an array of filesystem
87
87
directories as array keys and files as lists under each directory.
88
88
89
+ Core
90
+ ----
91
+
92
+ - Added ``Configure `` attribute to support injecting ``Configure `` values into
93
+ constructor arguments. See ref:`configure-dependency-injection `.
94
+
89
95
Database
90
96
--------
91
97
Original file line number Diff line number Diff line change @@ -213,13 +213,28 @@ services like in a reporting system::
213
213
return new ReportAggregate($container->get('reports'));
214
214
});
215
215
216
+ .. _configure-dependency-injection :
217
+
216
218
Using Configuration Data
217
219
------------------------
218
220
219
- Often you'll need configuration data in your services. While you could add
220
- all the configuration keys your service needs into the container, that can be
221
- tedious. To make configuration easier to work with CakePHP includes an
222
- injectable configuration reader::
221
+ Often you'll need configuration data in your services. If you need a specific value,
222
+ you can inject it as a constructor argument using the ``Cake\Core\Attribute\Configure ``
223
+ attribute::
224
+
225
+ use Cake\Core\Attribute\Configure;
226
+
227
+ class InjectedService
228
+ {
229
+ public function __construct(
230
+ #[Configure('MyService.apiKey')] protected string $apiKey,
231
+ ) { }
232
+ }
233
+
234
+ .. versionadded :: 5.3.0
235
+
236
+ If you want to inject a copy of all configuration data, CakePHP includes
237
+ an injectable configuration reader::
223
238
224
239
use Cake\Core\ServiceConfig;
225
240
You can’t perform that action at this time.
0 commit comments