LifecycleHookProviderInterface.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /*
  3. * This file is part of the Sonata Project package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Sonata\AdminBundle\Admin;
  11. /**
  12. * This interface can be implemented to provide hooks that will be called
  13. * during the lifecycle of the object.
  14. *
  15. * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
  16. */
  17. interface LifecycleHookProviderInterface
  18. {
  19. /**
  20. * This method should call preUpdate, do the update, and call postUpdate.
  21. *
  22. * @param object $object
  23. *
  24. * @return object
  25. */
  26. public function update($object);
  27. /**
  28. * This method should call prePersist, do the creation, and call postPersist.
  29. *
  30. * @param object $object
  31. *
  32. * @return object
  33. */
  34. public function create($object);
  35. /**
  36. * This method should call preRemove, do the removal, and call postRemove.
  37. *
  38. * @param object $object
  39. */
  40. public function delete($object);
  41. //NEXT_MAJOR: uncomment this method for 4.0
  42. // /**
  43. // * @param object $object
  44. // */
  45. // public function preValidate($object);
  46. /**
  47. * @param object $object
  48. */
  49. public function preUpdate($object);
  50. /**
  51. * @param object $object
  52. */
  53. public function postUpdate($object);
  54. /**
  55. * @param object $object
  56. */
  57. public function prePersist($object);
  58. /**
  59. * @param object $object
  60. */
  61. public function postPersist($object);
  62. /**
  63. * @param object $object
  64. */
  65. public function preRemove($object);
  66. /**
  67. * @param object $object
  68. */
  69. public function postRemove($object);
  70. }