AdapterInterface.php 3.5 KB

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