Model callbacks #47

Closed
opened 2014-05-14 20:34:23 +00:00 by geoffoliver · 2 comments
geoffoliver commented 2014-05-14 20:34:23 +00:00 (Migrated from github.com)

Add callbacks to model methods.

  • before/after find
  • before/after update
  • before/after delete

Possibly create event dispatcher to handle callbacks on Models and in other places (view before/after render?)

Add callbacks to model methods. - before/after find - before/after update - before/after delete Possibly create event dispatcher to handle callbacks on Models and in other places (view before/after render?)
joshtronic commented 2014-09-27 11:08:50 +00:00 (Migrated from github.com)

Got any use cases for this? One thought is massaging the data as an after find... not really following the before logic.

This /may/ be something that could be offloaded to the resource class as there is now a way (well soon, working through it now) to filter fields that are incoming

Got any use cases for this? One thought is massaging the data as an after find... not really following the before logic. This /may/ be something that could be offloaded to the resource class as there is now a way (well soon, working through it now) to filter fields that are incoming
geoffoliver commented 2014-09-27 20:57:24 +00:00 (Migrated from github.com)

Maybe so you could check query parameters and modify them? So, if you always want to add a 'user_id' into a query if it's not there, do it in the beforeFind instead of every time you want to retrieve data. Or to prevent a query from running if it doesn't have the correct parameters?

Maybe so you could check query parameters and modify them? So, if you always want to add a 'user_id' into a query if it's not there, do it in the beforeFind instead of every time you want to retrieve data. Or to prevent a query from running if it doesn't have the correct parameters?
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
joshtronic/pickles#47
No description provided.