Skip to content

Commit 1905e3c

Browse files
authored
Merge pull request #858 from Nitneuk2/fix-previous_data
[Security] Add information about previous_object
2 parents e16d47e + 7117570 commit 1905e3c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

core/security.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ that a user could not create a book.
7272

7373
Additionally, in some cases you need to perform security checks on the original data. For example here, only the actual owner should be allowed to edit their book. In these cases, you can use the `previous_object` variable which contains the object that was read from the data provider.
7474

75+
N.B `previous_object` is cloned from the original object. Note that this clone is not a deep one (it doesn't clone relationships, relationships are references), to [make a deep clone](https://www.php.net/manual/fr/language.oop5.cloning.php#object.clone) implement `__clone` method in the concerned resource class.
76+
7577
It is also possible to use the [event system](events.md) for more advanced logic or even [custom actions](operations.md#creating-custom-operations-and-controllers)
7678
if you really need to.
7779

0 commit comments

Comments
 (0)