Ticket #459 (closed Feature Request: wontfix)

Opened 9 months ago

Last modified 5 months ago

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

Change History

Changed 8 months ago by Shadowhand

#531 is a duplicate of this ticket, with slightly different goals.

Changed 5 months ago by Shadowhand

  • status changed from new to closed
  • resolution set to wontfix

This is better handled by overloading the save method.

Note: See TracTickets for help on using tickets.