Invoking database updates in action method

Say I want to update a record in a specific table each time another record is created, how would I accomplish that? For example, I have a items table and there are deliveries (There is a table for deliveries also) of that item. Each time a delivery is made I would like the quantity of the item to be increased by the amount that was delivered. I thought that update would be placed in the ActionCreate method of the ItemsController but that isn’t working. Any suggestions?

you could hook into afterSave callback and update the records it will only update it once the records are saved

http://www.yiiframework.com/doc/guide/1.1/en/database.ar#customization