ContentEntityNullStorage.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. namespace Drupal\Core\Entity;
  3. use Drupal\Core\Field\FieldDefinitionInterface;
  4. /**
  5. * Defines a null entity storage.
  6. *
  7. * Used for content entity types that have no storage.
  8. */
  9. class ContentEntityNullStorage extends ContentEntityStorageBase {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. public function loadMultiple(array $ids = NULL) {
  14. return [];
  15. }
  16. /**
  17. * {@inheritdoc}
  18. */
  19. protected function doLoadMultiple(array $ids = NULL) {
  20. }
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function load($id) {
  25. return NULL;
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function loadRevision($revision_id) {
  31. return NULL;
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function loadMultipleRevisions(array $revision_ids) {
  37. return [];
  38. }
  39. /**
  40. * {@inheritdoc}
  41. */
  42. public function deleteRevision($revision_id) {
  43. }
  44. /**
  45. * {@inheritdoc}
  46. */
  47. public function loadByProperties(array $values = []) {
  48. return [];
  49. }
  50. /**
  51. * {@inheritdoc}
  52. */
  53. public function delete(array $entities) {
  54. }
  55. /**
  56. * {@inheritdoc}
  57. */
  58. protected function doDelete($entities) {
  59. }
  60. /**
  61. * {@inheritdoc}
  62. */
  63. public function save(EntityInterface $entity) {
  64. }
  65. /**
  66. * {@inheritdoc}
  67. */
  68. protected function getQueryServiceName() {
  69. return 'entity.query.null';
  70. }
  71. /**
  72. * {@inheritdoc}
  73. */
  74. protected function doLoadRevisionFieldItems($revision_id) {
  75. }
  76. /**
  77. * {@inheritdoc}
  78. */
  79. protected function doSaveFieldItems(ContentEntityInterface $entity, array $names = []) {
  80. }
  81. /**
  82. * {@inheritdoc}
  83. */
  84. protected function doDeleteFieldItems($entities) {
  85. }
  86. /**
  87. * {@inheritdoc}
  88. */
  89. protected function doDeleteRevisionFieldItems(ContentEntityInterface $revision) {
  90. }
  91. /**
  92. * {@inheritdoc}
  93. */
  94. protected function readFieldItemsToPurge(FieldDefinitionInterface $field_definition, $batch_size) {
  95. return [];
  96. }
  97. /**
  98. * {@inheritdoc}
  99. */
  100. protected function purgeFieldItems(ContentEntityInterface $entity, FieldDefinitionInterface $field_definition) {
  101. }
  102. /**
  103. * {@inheritdoc}
  104. */
  105. protected function doSave($id, EntityInterface $entity) {
  106. }
  107. /**
  108. * {@inheritdoc}
  109. */
  110. protected function has($id, EntityInterface $entity) {
  111. }
  112. /**
  113. * {@inheritdoc}
  114. */
  115. public function countFieldData($storage_definition, $as_bool = FALSE) {
  116. return $as_bool ? FALSE : 0;
  117. }
  118. /**
  119. * {@inheritdoc}
  120. */
  121. public function hasData() {
  122. return FALSE;
  123. }
  124. }