File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,21 @@ Command
74
74
- ``cake server `` now supports a ``--frankenphp `` option that will start the
75
75
development server with `FrankenPHP <https://frankenphp.dev/ >`__.
76
76
77
+ Core
78
+ ----
79
+
80
+ - Added ``Configure `` attribute to support injecting ``Configure `` values into
81
+ constructor promoted properties when resolving a class from container. Example:
82
+
83
+ .. code-block :: php
84
+
85
+ class InjectedService
86
+ {
87
+ public function __construct(
88
+ #[Configure('MyService.apiKey')] protected string $apiKey,
89
+ ) { }
90
+ }
91
+
77
92
Cache
78
93
-----
79
94
Original file line number Diff line number Diff line change @@ -230,6 +230,26 @@ The ``ServiceConfig`` class provides a read-only view of all the data available
230
230
in ``Configure `` so you don't have to worry about accidentally changing
231
231
configuration.
232
232
233
+ Configure Property attribute
234
+ ----------------------------
235
+
236
+ Configure values can also be injected into constructor promoted properties using
237
+ the ``Cake\Core\Attribute\Configure `` attribute. This attribute takes the ``Configure ``
238
+ key as a parameter and the property will be set to that value when resolved.
239
+
240
+ .. code-block :: php
241
+
242
+ use Cake\Core\Attribute\Configure;
243
+
244
+ class InjectedService
245
+ {
246
+ public function __construct(
247
+ #[Configure('MyService.apiKey')] protected string $apiKey,
248
+ ) { }
249
+ }
250
+
251
+ .. versionadded :: 5.3.0
252
+
233
253
Service Providers
234
254
=================
235
255
You can’t perform that action at this time.
0 commit comments