Ticket #459 (closed Feature Request: wontfix)
New ORM methods and observer pattern
| Reported by: | memon | Owned by: | Shadowhand |
|---|---|---|---|
| Priority: | minor | Milestone: | 2.2 |
| Component: | Libraries:ORM | Version: | SVN HEAD |
| Keywords: | Cc: |
Description
Would it be possible to have a few ORM methods such as before_save, before_insert, before_update, after_save etc.. which would return true in the ORM class. Then they could be overridden in the models of the user. If they would return false then save() wouldn't be done or insert, update etc.
Relating to this is the excellent Event class which is now only utilized by Kohana's core afaik. In the ORM class they can run events such as Event::run(get_class($this)'.before_save',$this); It would be nice for such an observer pattern in ORM.
Maybe it could also work in conjunction with the SPL observer class. http://www.php.net/~helly/php/ext/spl/classSplObjectStorage.html#_details
