TranslatableAdapter.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. * @param string $targetClass
  48. * @return void
  49. */
  50. function removeAssociatedTranslations($objectId, $transClass, $targetClass);
  51. /**
  52. * Inserts the translation record
  53. *
  54. * @param object $translation
  55. * @return void
  56. */
  57. function insertTranslationRecord($translation);
  58. /**
  59. * Get the transformed value for translation
  60. * storage
  61. *
  62. * @param object $object
  63. * @param string $field
  64. * @param mixed $value
  65. * @return mixed
  66. */
  67. function getTranslationValue($object, $field, $value = false);
  68. /**
  69. * Transform the value from database
  70. * for translation
  71. *
  72. * @param object $object
  73. * @param string $field
  74. * @param mixed $value
  75. */
  76. function setTranslationValue($object, $field, $value);
  77. }