Skip to content

Commit 3a1c8df

Browse files
authored
add docs about new table entity assertion (#8303)
* add docs about new table entity assertion * add docs about new table entity assertion
1 parent 663c898 commit 3a1c8df

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

docs/en/appendices/5-4-migration-guide.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ See [Application and Plugin Events](../core-libraries/events#registering-event-l
5858
these events were silently suppressed. They are now deferred until the
5959
outermost transaction commits, and discarded on rollback.
6060
See [Table Objects](../orm/table-objects#aftersavecommit) for more details.
61+
- Table methods `save()`, `delete()`, `patchEntity()`, `patchEntities()` and `loadInto()`
62+
will now throw an exception if the entity being passed down does not belong to the table instance.
63+
This will prevent accidental data corruption or deleted records. If you don't want this new behavior,
64+
you can disable it by calling `$this->disableEntityClassAssertion();` in your `initialize()` method.
6165

6266
### Controller
6367

docs/en/orm/table-objects.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@ As seen in the examples above Table objects have an `initialize()` method
9595
which is called at the end of the constructor. It is recommended that you use
9696
this method to do initialization logic instead of overriding the constructor.
9797

98+
::: tip Added in version 5.4.0
99+
Table methods `save()`, `delete()`, `patchEntity()`, `patchEntities()` and `loadInto()`
100+
will throw an exception if the entity being passed down does not belong to the table instance.
101+
This will prevent accidental data corruption or deleted records.
102+
103+
If you don't want this new behavior, you can disable it by calling
104+
`$this->disableEntityClassAssertion();` in your `initialize()` method.
105+
:::
106+
98107
### Getting Instances of a Table Class
99108

100109
Before you can query a table, you'll need to get an instance of the table. You

0 commit comments

Comments
 (0)