You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: user_guide_src/source/general/context.rst
+13-17Lines changed: 13 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,10 +94,6 @@ You can check if a key exists in the context:
94
94
95
95
.. literalinclude:: context/010.php
96
96
97
-
Or check if a key is missing (the opposite of ``has()``):
98
-
99
-
.. literalinclude:: context/011.php
100
-
101
97
*********************
102
98
Removing Context Data
103
99
*********************
@@ -107,21 +103,21 @@ Removing a Single Value
107
103
108
104
You can remove data from the context using the ``remove()`` method:
109
105
110
-
.. literalinclude:: context/012.php
106
+
.. literalinclude:: context/011.php
111
107
112
108
Removing Multiple Values
113
109
=========================
114
110
115
111
To remove multiple keys at once, pass an array:
116
112
117
-
.. literalinclude:: context/013.php
113
+
.. literalinclude:: context/012.php
118
114
119
115
Clearing All Data
120
116
=================
121
117
122
118
To remove all context data:
123
119
124
-
.. literalinclude:: context/014.php
120
+
.. literalinclude:: context/013.php
125
121
126
122
*********************
127
123
Hidden Context Data
@@ -136,47 +132,47 @@ Setting Hidden Data
136
132
137
133
Use the ``setHidden()`` method to store sensitive data:
138
134
139
-
.. literalinclude:: context/015.php
135
+
.. literalinclude:: context/014.php
140
136
141
137
You can also set multiple hidden values at once:
142
138
143
-
.. literalinclude:: context/016.php
139
+
.. literalinclude:: context/015.php
144
140
145
141
Getting Hidden Data
146
142
===================
147
143
148
144
Retrieve hidden data using ``getHidden()``:
149
145
150
-
.. literalinclude:: context/017.php
146
+
.. literalinclude:: context/016.php
151
147
152
148
The same methods available for regular data also work with hidden data:
153
149
154
-
.. literalinclude:: context/018.php
150
+
.. literalinclude:: context/017.php
155
151
156
152
Checking Hidden Data
157
153
====================
158
154
159
155
Check if a hidden key exists:
160
156
161
-
.. literalinclude:: context/019.php
157
+
.. literalinclude:: context/018.php
162
158
163
159
Removing Hidden Data
164
160
====================
165
161
166
162
Remove hidden data using ``removeHidden()``:
167
163
168
-
.. literalinclude:: context/020.php
164
+
.. literalinclude:: context/019.php
169
165
170
166
Clearing Hidden Data
171
167
====================
172
168
173
169
To clear all hidden data without affecting regular context data:
174
170
175
-
.. literalinclude:: context/021.php
171
+
.. literalinclude:: context/020.php
176
172
177
173
To clear both regular and hidden data:
178
174
179
-
.. literalinclude:: context/022.php
175
+
.. literalinclude:: context/021.php
180
176
181
177
.. important:: Regular data and hidden data are stored separately. A key can exist in both regular and hidden storage with different values. Use ``get()`` for regular data and ``getHidden()`` for hidden data.
182
178
@@ -193,11 +189,11 @@ Enabling Global Context Logging
193
189
To enable automatic logging of context data, set the ``$logGlobalContext`` property to ``true`` in your
194
190
**app/Config/Logger.php** file:
195
191
196
-
.. literalinclude:: context/023.php
192
+
.. literalinclude:: context/022.php
197
193
198
194
When enabled, all context data (excluding hidden data) will be automatically appended to your log messages as JSON:
0 commit comments