ImportableEntityStorageInterface.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace Drupal\Core\Config\Entity;
  3. use Drupal\Core\Config\Config;
  4. /**
  5. * Provides an interface for responding to configuration imports.
  6. *
  7. * When configuration is synchronized between storages, the entity storage must
  8. * handle the synchronization of configuration data for its entity.
  9. */
  10. interface ImportableEntityStorageInterface {
  11. /**
  12. * Creates entities upon synchronizing configuration changes.
  13. *
  14. * @param string $name
  15. * The name of the configuration object.
  16. * @param \Drupal\Core\Config\Config $new_config
  17. * A configuration object containing the new configuration data.
  18. * @param \Drupal\Core\Config\Config $old_config
  19. * A configuration object containing the old configuration data.
  20. */
  21. public function importCreate($name, Config $new_config, Config $old_config);
  22. /**
  23. * Updates entities upon synchronizing configuration changes.
  24. *
  25. * @param string $name
  26. * The name of the configuration object.
  27. * @param \Drupal\Core\Config\Config $new_config
  28. * A configuration object containing the new configuration data.
  29. * @param \Drupal\Core\Config\Config $old_config
  30. * A configuration object containing the old configuration data.
  31. *
  32. * @throws \Drupal\Core\Config\ConfigImporterException
  33. * Thrown when the config entity that should be updated can not be found.
  34. */
  35. public function importUpdate($name, Config $new_config, Config $old_config);
  36. /**
  37. * Delete entities upon synchronizing configuration changes.
  38. *
  39. * @param string $name
  40. * The name of the configuration object.
  41. * @param \Drupal\Core\Config\Config $new_config
  42. * A configuration object containing the new configuration data.
  43. * @param \Drupal\Core\Config\Config $old_config
  44. * A configuration object containing the old configuration data.
  45. */
  46. public function importDelete($name, Config $new_config, Config $old_config);
  47. /**
  48. * Renames entities upon synchronizing configuration changes.
  49. *
  50. * @param string $old_name
  51. * The original name of the configuration object.
  52. * @param \Drupal\Core\Config\Config $new_config
  53. * A configuration object containing the new configuration data.
  54. * @param \Drupal\Core\Config\Config $old_config
  55. * A configuration object containing the old configuration data.
  56. */
  57. public function importRename($old_name, Config $new_config, Config $old_config);
  58. }