Modifying Default Actions

Model_Table implements 5 primary actions by default: Insert, Load, Modify, Delete, Unload. There is also action "Save" which is a wrapper around Load and Insert. Let's review the following code and track the sequence of methods and hooks as they are being called

$book->load(5)->set('name','MyBook')->save();;

The sequence of calls is like this:

  • load starts
  • hook: beforeLoad
  • dsql/select()
  • hook: afterLoad
  • load exits
  • save starts
  • SQL transaction starts
  • hook: beforeSave
    • modify starts
    • hook: beforeModify
    • dsql/update()
    • hook: aftetrModify
    • modify exits
  • hook: afterSave
  • SQL transactions commits
  • save exists

By defining hooks or overriding methods you can change the way how these actions are performed

TODO: table with hook arguments