ConfigEntityStorageInterface.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace Drupal\Core\Config\Entity;
  3. use Drupal\Core\Entity\EntityStorageInterface;
  4. /**
  5. * Provides an interface for configuration entity storage.
  6. */
  7. interface ConfigEntityStorageInterface extends EntityStorageInterface {
  8. /**
  9. * Extracts the configuration entity ID from the full configuration name.
  10. *
  11. * @param string $config_name
  12. * The full configuration name to extract the ID from; for example,
  13. * 'views.view.archive'.
  14. * @param string $config_prefix
  15. * The config prefix of the configuration entity; for example, 'views.view'.
  16. *
  17. * @return string
  18. * The ID of the configuration entity.
  19. */
  20. public static function getIDFromConfigName($config_name, $config_prefix);
  21. /**
  22. * Creates a configuration entity from storage values.
  23. *
  24. * Allows the configuration entity storage to massage storage values before
  25. * creating an entity.
  26. *
  27. * @param array $values
  28. * The array of values from the configuration storage.
  29. *
  30. * @return ConfigEntityInterface
  31. * The configuration entity.
  32. *
  33. * @see \Drupal\Core\Entity\EntityStorageBase::mapFromStorageRecords()
  34. * @see \Drupal\field\FieldStorageConfigStorage::mapFromStorageRecords()
  35. */
  36. public function createFromStorageRecord(array $values);
  37. /**
  38. * Updates a configuration entity from storage values.
  39. *
  40. * Allows the configuration entity storage to massage storage values before
  41. * updating an entity.
  42. *
  43. * @param ConfigEntityInterface $entity
  44. * The configuration entity to update.
  45. * @param array $values
  46. * The array of values from the configuration storage.
  47. *
  48. * @return ConfigEntityInterface
  49. * The configuration entity.
  50. *
  51. * @see \Drupal\Core\Entity\EntityStorageBase::mapFromStorageRecords()
  52. * @see \Drupal\field\FieldStorageConfigStorage::mapFromStorageRecords()
  53. */
  54. public function updateFromStorageRecord(ConfigEntityInterface $entity, array $values);
  55. /**
  56. * Loads one entity in their original form without overrides.
  57. *
  58. * @param mixed $id
  59. * The ID of the entity to load.
  60. *
  61. * @return \Drupal\Core\Entity\EntityInterface|null
  62. * An entity object. NULL if no matching entity is found.
  63. */
  64. public function loadOverrideFree($id);
  65. /**
  66. * Loads one or more entities in their original form without overrides.
  67. *
  68. * @param $ids
  69. * An array of entity IDs, or NULL to load all entities.
  70. *
  71. * @return \Drupal\Core\Entity\EntityInterface[]
  72. * An array of entity objects indexed by their IDs. Returns an empty array
  73. * if no matching entities are found.
  74. */
  75. public function loadMultipleOverrideFree(array $ids = NULL);
  76. }