How to hook to events of objects?
I am a drupal developer and am accustomed to the concept of hooks. In a nutshell a hook is a way to jump into the workflow for adding, altering or listening to an event, say for instance "before saving an user" event.
Now lets say for instance that in my custom module I want to grab the invoice data right before it is about to be saved into the database and after all the installed modules have done their bit.
How do I get my module to hook to that particular point in the workflow, what I would call event.
In my use case I would like to get that data and save it somewhere else in real time.