From 64680577a14100f7b3bdc44bcda7520d0b426996 Mon Sep 17 00:00:00 2001 From: MGatner Date: Tue, 25 Aug 2020 18:37:14 +0000 Subject: [PATCH] [ci skip] Add note on entity properties, closes #2317 --- user_guide_src/source/models/entities.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/models/entities.rst b/user_guide_src/source/models/entities.rst index e6b5168e92cc..5ca5436edd9b 100644 --- a/user_guide_src/source/models/entities.rst +++ b/user_guide_src/source/models/entities.rst @@ -126,7 +126,7 @@ on your entities without worrying much about stray fields getting saved incorrec $user->fill($data); $userModel->save($user); -You can also pass the data in the constructor and the data will be passed through the `fill()` method during instantiation. +You can also pass the data in the constructor and the data will be passed through the ``fill()`` method during instantiation. :: @@ -135,6 +135,14 @@ You can also pass the data in the constructor and the data will be passed throug $user = new \App\Entities\User($data); $userModel->save($user); +Bulk Accessing Properties +------------------------- + +The Entity class has two methods to extract all available properties into an array: ``toArray()`` and ``toRawArray()``. +Using the raw version will bypass magic "getter" methods and casts. Both methods can take a boolean first parameter +to specify whether returned values should be filtered by those that have changed, and a boolean final parameter to +make the method recursive, in case of nested Entities. + Handling Business Logic =======================