AdapterInterface.php 2.8KB

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