AdapterInterface.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. namespace Gedmo\Mapping\Event;
  3. use Doctrine\Common\EventArgs;
  4. /**
  5. * Doctrine event adapter interface is used
  6. * to retrieve common functionality for Doctrine
  7. * events
  8. *
  9. * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  10. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  11. */
  12. interface AdapterInterface
  13. {
  14. /**
  15. * Set the eventargs
  16. *
  17. * @param \Doctrine\Common\EventArgs $args
  18. */
  19. function setEventArgs(EventArgs $args);
  20. /**
  21. * Call specific method on event args
  22. *
  23. * @param string $method
  24. * @param array $args
  25. * @return mixed
  26. */
  27. function __call($method, $args);
  28. /**
  29. * Get the name of domain object
  30. *
  31. * @return string
  32. */
  33. function getDomainObjectName();
  34. /**
  35. * Get the name of used manager for this
  36. * event adapter
  37. *
  38. * @return string
  39. */
  40. function getManagerName();
  41. /**
  42. * Get the root object class, handles inheritance
  43. *
  44. * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata
  45. * @return string
  46. */
  47. function getRootObjectClass($meta);
  48. /**
  49. * Get used object manager
  50. *
  51. * @return \Doctrine\Common\Persistence\ObjectManager
  52. */
  53. function getObjectManager();
  54. /**
  55. * Get the object changeset from a UnitOfWork
  56. *
  57. * @param UnitOfWork $uow
  58. * @param Object $object
  59. * @return array
  60. */
  61. function getObjectChangeSet($uow, $object);
  62. /**
  63. * Get the single identifier field name
  64. *
  65. * @param ClassMetadata $meta
  66. * @return string
  67. */
  68. function getSingleIdentifierFieldName($meta);
  69. /**
  70. * Recompute the single object changeset from a UnitOfWork
  71. *
  72. * @param UnitOfWork $uow
  73. * @param ClassMetadata $meta
  74. * @param Object $object
  75. * @return void
  76. */
  77. function recomputeSingleObjectChangeSet($uow, $meta, $object);
  78. /**
  79. * Get the scheduled object updates from a UnitOfWork
  80. *
  81. * @param UnitOfWork $uow
  82. * @return array
  83. */
  84. function getScheduledObjectUpdates($uow);
  85. /**
  86. * Get the scheduled object insertions from a UnitOfWork
  87. *
  88. * @param UnitOfWork $uow
  89. * @return array
  90. */
  91. function getScheduledObjectInsertions($uow);
  92. /**
  93. * Get the scheduled object deletions from a UnitOfWork
  94. *
  95. * @param UnitOfWork $uow
  96. * @return array
  97. */
  98. function getScheduledObjectDeletions($uow);
  99. /**
  100. * Sets a property value of the original data array of an object
  101. *
  102. * @param UnitOfWork $uow
  103. * @param string $oid
  104. * @param string $property
  105. * @param mixed $value
  106. * @return void
  107. */
  108. function setOriginalObjectProperty($uow, $oid, $property, $value);
  109. /**
  110. * Clears the property changeset of the object with the given OID.
  111. *
  112. * @param UnitOfWork $uow
  113. * @param string $oid The object's OID.
  114. */
  115. function clearObjectChangeSet($uow, $oid);
  116. }