ReferencesAdapter.php 1.4 KB

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