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
{{ message }}
Repository navigation
Commit 2ff3fc8
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: user_guide_src/source/changelogs/v4.8.0.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -276,7 +276,7 @@ Model
276
276
=====
277
277
278
278
- Added ``chunkRows()``, ``chunkById()``, and ``chunkRowsById()`` methods to ``CodeIgniter\Model`` for processing large datasets in chunks.
279
-
- Added ``encrypted`` casting for Entity properties and Model fields using the Encryption service. See :ref:`model-field-casting-encrypted`.
279
+
- Added ``encrypted``, ``encrypted-json`` and ``encrypted-json-array`` casting for Entity properties and Model fields using the Encryption service. See :ref:`model-field-casting-encrypted`.
280
280
- Added ``firstOrInsert()`` method to ``CodeIgniter\Model`` that finds the first row matching the given attributes or inserts a new one. See :ref:`model-first-or-insert`.
281
281
- Added ``$insertOnlyFields`` and ``setInsertOnlyFields()`` to ``CodeIgniter\Model`` to remove configured fields from Model update operations while allowing them during inserts. See :ref:`model-insert-only-fields`.
282
282
- Added ``$throwOnDisallowedFields`` and ``throwOnDisallowedFields()`` to ``CodeIgniter\Model`` to throw a ``DataException`` when write data contains fields that would otherwise be discarded by ``$allowedFields``. See :ref:`model-throw-on-disallowed-fields`.
Add a question mark at the beginning of type to mark property as nullable, i.e., **?string**, **?integer**.
261
261
262
262
.. note:: **int-bool** can be used since v4.3.0.
263
263
.. note:: **enum** can be used since v4.7.0.
264
-
.. note:: **encrypted** can be used since v4.8.0.
264
+
.. note:: **encrypted**, **encrypted-json** and **encrypted-json-array** can be used since v4.8.0.
265
265
.. note:: Since v4.8.0, you can also pass parameters to **float** and **double** types to specify the number of decimal places and rounding mode, i.e., **float[2,even]**.
266
266
267
267
For example, if you had a User entity with an ``is_banned`` property, you can cast it as a boolean:
@@ -349,6 +349,12 @@ for nullable values.
349
349
350
350
.. literalinclude:: entities/029.php
351
351
352
+
The ``encrypted-json`` and ``encrypted-json-array`` types JSON encode values
353
+
before encryption and JSON decode them after decryption. The ``encrypted-json``
354
+
type returns ``stdClass`` values, while ``encrypted-json-array`` returns arrays.
355
+
Use ``?encrypted-json`` and ``?encrypted-json-array`` for nullable values. These
356
+
values are still stored as encrypted text, not as queryable database JSON.
357
+
352
358
Encrypted values are stored as Base64-encoded ciphertext. Use a ``TEXT`` column
353
359
or a sufficiently large string column because the stored value is longer than
354
360
the plain text value. Avoid narrow columns like ``VARCHAR(255)`` unless you have
0 commit comments