self.php 690 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * Fuel is a fast, lightweight, community driven PHP5 framework.
  4. *
  5. * @package Fuel
  6. * @version 1.5
  7. * @author Fuel Development Team
  8. * @license MIT License
  9. * @copyright 2010 - 2013 Fuel Development Team
  10. * @link http://fuelphp.com
  11. */
  12. namespace Orm;
  13. /**
  14. * Dummy observer class, which allows you to define observer methods in the
  15. * model itself.
  16. */
  17. class Observer_Self
  18. {
  19. /**
  20. * Get notified of an event
  21. *
  22. * @param Model $instance
  23. * @param string $event
  24. */
  25. public static function orm_notify(Model $instance, $event)
  26. {
  27. if (method_exists($instance, $method = '_event_'.$event))
  28. {
  29. call_user_func(array($instance, $method));
  30. }
  31. }
  32. }