Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/en/appendices/5-4-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ See [Application and Plugin Events](../core-libraries/events#registering-event-l
these events were silently suppressed. They are now deferred until the
outermost transaction commits, and discarded on rollback.
See [Table Objects](../orm/table-objects#aftersavecommit) for more details.
- Table methods `save()`, `delete()`, `patchEntity()`, `patchEntities()` and `loadInto()`
will now throw an exception if the entity being passed down does not belong to the table instance.
This will prevent accidental data corruption or deleted records. If you don't want this new behavior,
you can disable it by calling `$this->disableEntityClassAssertion();` in your `initialize()` method.

### Controller

Expand Down
9 changes: 9 additions & 0 deletions docs/en/orm/table-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ As seen in the examples above Table objects have an `initialize()` method
which is called at the end of the constructor. It is recommended that you use
this method to do initialization logic instead of overriding the constructor.

::: tip Added in version 5.4.0
Table methods `save()`, `delete()`, `patchEntity()`, `patchEntities()` and `loadInto()`
will throw an exception if the entity being passed down does not belong to the table instance.
This will prevent accidental data corruption or deleted records.

If you don't want this new behavior, you can disable it by calling
`$this->disableEntityClassAssertion();` in your `initialize()` method.
:::

### Getting Instances of a Table Class

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