TranslatableAdapter.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. /**
  58. * Get the transformed value for translation
  59. * storage
  60. *
  61. * @param object $object
  62. * @param string $field
  63. * @return mixed
  64. */
  65. function getTranslationValue($object, $field);
  66. /**
  67. * Transform the value from database
  68. * for translation
  69. *
  70. * @param object $object
  71. * @param string $field
  72. * @param mixed $value
  73. */
  74. function setTranslationValue($object, $field, $value);
  75. }