TranslatableAdapter.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace Gedmo\Translatable\Mapping\Event;
  3. use Gedmo\Mapping\Event\AdapterInterface;
  4. /**
  5. * Doctrine event adapter interface
  6. * for Translatable behavior
  7. *
  8. * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  9. * @package Gedmo\Translatable\Mapping\Event
  10. * @subpackage TranslatableAdapter
  11. * @link http://www.gediminasm.org
  12. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  13. */
  14. interface TranslatableAdapter extends AdapterInterface
  15. {
  16. /**
  17. * Get default LogEntry class used to store the logs
  18. *
  19. * @return string
  20. */
  21. function getDefaultTranslationClass();
  22. /**
  23. * Load the translations for a given object
  24. *
  25. * @param object $object
  26. * @param string $translationClass
  27. * @param string $locale
  28. * @return array
  29. */
  30. function loadTranslations($object, $translationClass, $locale);
  31. /**
  32. * Search for existing translation record
  33. *
  34. * @param mixed $objectId
  35. * @param string $objectClass
  36. * @param string $locale
  37. * @param string $field
  38. * @param string $translationClass
  39. * @return mixed - null if nothing is found, Translation otherwise
  40. */
  41. function findTranslation($objectId, $objectClass, $locale, $field, $translationClass);
  42. /**
  43. * Removes all associated translations for given object
  44. *
  45. * @param mixed $objectId
  46. * @param string $transClass
  47. * @return void
  48. */
  49. function removeAssociatedTranslations($objectId, $transClass);
  50. /**
  51. * Inserts the translation record
  52. *
  53. * @param object $translation
  54. * @return void
  55. */
  56. function insertTranslationRecord($translation);
  57. }