ContentEntityNullStorage.php 2.4 KB
Newer Older
1 2 3 4
<?php

namespace Drupal\Core\Entity;

5
use Drupal\Core\Field\FieldDefinitionInterface;
6 7

/**
8
 * Defines a null entity storage.
9 10 11
 *
 * Used for content entity types that have no storage.
 */
12
class ContentEntityNullStorage extends ContentEntityStorageBase {
13 14 15 16 17

  /**
   * {@inheritdoc}
   */
  public function loadMultiple(array $ids = NULL) {
18
    return [];
19 20
  }

21 22 23 24 25 26
  /**
   * {@inheritdoc}
   */
  protected function doLoadMultiple(array $ids = NULL) {
  }

27 28 29 30 31 32 33 34 35 36 37 38 39 40
  /**
   * {@inheritdoc}
   */
  public function load($id) {
    return NULL;
  }

  /**
   * {@inheritdoc}
   */
  public function loadRevision($revision_id) {
    return NULL;
  }

41 42 43 44 45 46 47
  /**
   * {@inheritdoc}
   */
  public function loadMultipleRevisions(array $revision_ids) {
    return [];
  }

48 49 50 51 52 53 54 55 56
  /**
   * {@inheritdoc}
   */
  public function deleteRevision($revision_id) {
  }

  /**
   * {@inheritdoc}
   */
57 58
  public function loadByProperties(array $values = []) {
    return [];
59 60 61 62 63 64 65 66
  }

  /**
   * {@inheritdoc}
   */
  public function delete(array $entities) {
  }

67 68 69 70 71 72
  /**
   * {@inheritdoc}
   */
  protected function doDelete($entities) {
  }

73 74 75 76 77 78 79 80 81
  /**
   * {@inheritdoc}
   */
  public function save(EntityInterface $entity) {
  }

  /**
   * {@inheritdoc}
   */
82
  protected function getQueryServiceName() {
83
    return 'entity.query.null';
84 85 86 87 88
  }

  /**
   * {@inheritdoc}
   */
89
  protected function doLoadRevisionFieldItems($revision_id) {
90 91 92 93 94
  }

  /**
   * {@inheritdoc}
   */
95
  protected function doSaveFieldItems(ContentEntityInterface $entity, array $names = []) {
96 97 98 99 100
  }

  /**
   * {@inheritdoc}
   */
101
  protected function doDeleteFieldItems($entities) {
102 103 104 105 106
  }

  /**
   * {@inheritdoc}
   */
107
  protected function doDeleteRevisionFieldItems(ContentEntityInterface $revision) {
108 109 110 111 112
  }

  /**
   * {@inheritdoc}
   */
113
  protected function readFieldItemsToPurge(FieldDefinitionInterface $field_definition, $batch_size) {
114
    return [];
115 116 117 118 119
  }

  /**
   * {@inheritdoc}
   */
120
  protected function purgeFieldItems(ContentEntityInterface $entity, FieldDefinitionInterface $field_definition) {
121 122
  }

123 124 125 126 127 128 129 130 131 132 133 134
  /**
   * {@inheritdoc}
   */
  protected function doSave($id, EntityInterface $entity) {
  }

  /**
   * {@inheritdoc}
   */
  protected function has($id, EntityInterface $entity) {
  }

135 136 137 138 139 140 141
  /**
   * {@inheritdoc}
   */
  public function countFieldData($storage_definition, $as_bool = FALSE) {
    return $as_bool ? FALSE : 0;
  }

142 143 144 145 146 147 148
  /**
   * {@inheritdoc}
   */
  public function hasData() {
    return FALSE;
  }

149
}