HeartbeatStorageInterface.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace Drupal\heartbeat8;
  3. use Drupal\Core\Entity\ContentEntityStorageInterface;
  4. use Drupal\Core\Session\AccountInterface;
  5. use Drupal\Core\Language\LanguageInterface;
  6. use Drupal\heartbeat8\Entity\HeartbeatInterface;
  7. /**
  8. * Defines the storage handler class for Heartbeat entities.
  9. *
  10. * This extends the base storage class, adding required special handling for
  11. * Heartbeat entities.
  12. *
  13. * @ingroup heartbeat8
  14. */
  15. interface HeartbeatStorageInterface extends ContentEntityStorageInterface {
  16. /**
  17. * Gets a list of Heartbeat revision IDs for a specific Heartbeat.
  18. *
  19. * @param \Drupal\heartbeat8\Entity\HeartbeatInterface $entity
  20. * The Heartbeat entity.
  21. *
  22. * @return int[]
  23. * Heartbeat revision IDs (in ascending order).
  24. */
  25. public function revisionIds(HeartbeatInterface $entity);
  26. /**
  27. * Gets a list of revision IDs having a given user as Heartbeat author.
  28. *
  29. * @param \Drupal\Core\Session\AccountInterface $account
  30. * The user entity.
  31. *
  32. * @return int[]
  33. * Heartbeat revision IDs (in ascending order).
  34. */
  35. public function userRevisionIds(AccountInterface $account);
  36. /**
  37. * Counts the number of revisions in the default language.
  38. *
  39. * @param \Drupal\heartbeat8\Entity\HeartbeatInterface $entity
  40. * The Heartbeat entity.
  41. *
  42. * @return int
  43. * The number of revisions in the default language.
  44. */
  45. public function countDefaultLanguageRevisions(HeartbeatInterface $entity);
  46. /**
  47. * Unsets the language for all Heartbeat with the given language.
  48. *
  49. * @param \Drupal\Core\Language\LanguageInterface $language
  50. * The language object.
  51. */
  52. public function clearRevisionsLanguage(LanguageInterface $language);
  53. }