Skip to content

Commit dd077aa

Browse files
committed
docs: add user guide
1 parent 076a542 commit dd077aa

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

user_guide_src/source/changelogs/v4.3.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Enhancements
5959
- Now **Encryption** can decrypt data encrypted with CI3's Encryption. See :ref:`encryption-compatible-with-ci3`.
6060
- Added method ``Timer::record()`` to measure performance in a callable. Also enhanced common function ``timer()`` to accept optional callable.
6161
- Now ``spark routes`` command shows route names. See :ref:`URI Routing <routing-spark-routes>`.
62+
- Added new :ref:`entities-property-casting` class ``IntBoolCast`` for Entity.
6263

6364
Changes
6465
*******

user_guide_src/source/models/entities.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,16 @@ current timezone, as set in **app/Config/App.php**:
187187

188188
.. literalinclude:: entities/011.php
189189

190+
.. _entities-property-casting:
191+
190192
Property Casting
191193
----------------
192194

193195
You can specify that properties in your Entity should be converted to common data types with the ``$casts`` property.
194196
This option should be an array where the key is the name of the class property, and the value is the data type it
195197
should be cast to. Casting only affects when values are read. No conversions happen that affect the permanent value in
196198
either the entity or the database. Properties can be cast to any of the following data types:
197-
**integer**, **float**, **double**, **string**, **boolean**, **object**, **array**, **datetime**, **timestamp**, and **uri**.
199+
**integer**, **float**, **double**, **string**, **boolean**, **object**, **array**, **datetime**, **timestamp**, **uri** and **int-bool**.
198200
Add a question mark at the beginning of type to mark property as nullable, i.e., **?string**, **?integer**.
199201

200202
For example, if you had a User entity with an ``is_banned`` property, you can cast it as a boolean:

0 commit comments

Comments
 (0)