ReferencesAdapter.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace Gedmo\References\Mapping\Event;
  3. use Doctrine\Common\Persistence\Mapping\ClassMetadata;
  4. use Doctrine\Common\Persistence\ObjectManager;
  5. use Gedmo\Mapping\Event\AdapterInterface;
  6. /**
  7. * Doctrine event adapter interface for References behavior
  8. *
  9. * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  10. * @author Bulat Shakirzyanov <mallluhuct@gmail.com>
  11. * @author Jonathan H. Wage <jonwage@gmail.com>
  12. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  13. */
  14. interface ReferencesAdapter extends AdapterInterface
  15. {
  16. /**
  17. * Gets the identifier of the given object using the passed ObjectManager.
  18. *
  19. * @param ObjectManager $om
  20. * @param object $object
  21. * @param bool $single
  22. * @return array|scalar $id - array or single identifier
  23. */
  24. function getIdentifier($om, $object, $single = true);
  25. /**
  26. * Gets a single reference for the given ObjectManager, class and identifier.
  27. *
  28. * @param ObjectManager $om
  29. * @param string $class
  30. * @param array|scalar $identifier
  31. **/
  32. function getSingleReference($om, $class, $identifier);
  33. /**
  34. * Extracts identifiers from object or proxy.
  35. *
  36. * @param DocumentManager $om
  37. * @param object $object
  38. * @param bool $single
  39. * @return array|scalar - array or single identifier
  40. */
  41. function extractIdentifier($om, $object, $single = true);
  42. }