DynamicallyFieldableEntityStorageInterface.php 1.91 KB
Newer Older
1 2 3 4
<?php

/**
 * @file
5
 * Contains \Drupal\Core\Entity\DynamicallyFieldableEntityStorageInterface.
6 7 8 9
 */

namespace Drupal\Core\Entity;

10
use Drupal\Core\Field\FieldDefinitionInterface;
11
use Drupal\Core\Field\FieldDefinitionListenerInterface;
12
use Drupal\Core\Field\FieldStorageDefinitionInterface;
13
use Drupal\Core\Field\FieldStorageDefinitionListenerInterface;
14

15 16 17 18 19 20 21 22 23
/**
 * A storage that supports entity types with dynamic field definitions.
 *
 * A storage that implements this interface can react to the entity type's field
 * definitions changing, due to modules being installed or uninstalled, or via
 * field UI, or via code changes to the entity class.
 *
 * For example, configurable fields defined and exposed by field.module.
 */
24
interface DynamicallyFieldableEntityStorageInterface extends FieldableEntityStorageInterface, FieldStorageDefinitionListenerInterface, FieldDefinitionListenerInterface {
25 26 27 28 29 30 31 32 33

  /**
   * Determines if the storage contains any data.
   *
   * @return bool
   *   TRUE if the storage contains data, FALSE if not.
   */
  public function hasData();

34
  /**
35 36 37 38 39 40 41 42 43 44 45 46 47 48
   * Purges a batch of field data.
   *
   * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
   *   The deleted field whose data is being purged.
   * @param $batch_size
   *   The maximum number of field data records to purge before returning,
   *   relating to the count of field data records returned by
   *   \Drupal\Core\Entity\FieldableEntityStorageInterface::countFieldData().
   *
   * @return int
   *   The number of field data records that have been purged.
   */
  public function purgeFieldData(FieldDefinitionInterface $field_definition, $batch_size);

49
  /**
50
   * Performs final cleanup after all data of a field has been purged.
51
   *
52
   * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition
53 54
   *   The field being purged.
   */
55
  public function finalizePurge(FieldStorageDefinitionInterface $storage_definition);
56 57

}