Skip to content

Commit

Permalink
add notice for model events in fields
Browse files Browse the repository at this point in the history
  • Loading branch information
pxpm committed Feb 1, 2024
1 parent e430cd1 commit 524a270
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions 6.x/crud-operation-create.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ CRUD::addField([
]);
```

> An important thing to notice when using model events in the fields is that those events will only be registered **in the same operations (create, update, etc)** where your fields are defined.
> Take for example the `DeleteOperation`, which is ran when you delete an entry. If you define a field with a `deleting` event, that event will not be registered when you delete an entry, because the field is not defined in the `DeleteOperation`. If you want to use model events in the `DeleteOperation`, you can do that by using the `setupDeleteOperation()` method and defining the fields with the events there too, similar to how you do for create and update operations.
#### Override the `store()` method

The store code is inside a trait, so you can easily override it, if you want:
Expand Down

0 comments on commit 524a270

Please sign in to comment.