Version 1
[yaffs-website] / web / core / lib / Drupal / Core / Entity / DynamicallyFieldableEntityStorageInterface.php
1 <?php
2
3 namespace Drupal\Core\Entity;
4
5 use Drupal\Core\Field\FieldDefinitionInterface;
6 use Drupal\Core\Field\FieldDefinitionListenerInterface;
7 use Drupal\Core\Field\FieldStorageDefinitionInterface;
8 use Drupal\Core\Field\FieldStorageDefinitionListenerInterface;
9
10 /**
11  * A storage that supports entity types with dynamic field definitions.
12  *
13  * A storage that implements this interface can react to the entity type's field
14  * definitions changing, due to modules being installed or uninstalled, or via
15  * field UI, or via code changes to the entity class.
16  *
17  * For example, configurable fields defined and exposed by field.module.
18  */
19 interface DynamicallyFieldableEntityStorageInterface extends FieldableEntityStorageInterface, FieldStorageDefinitionListenerInterface, FieldDefinitionListenerInterface {
20
21   /**
22    * Determines if the storage contains any data.
23    *
24    * @return bool
25    *   TRUE if the storage contains data, FALSE if not.
26    */
27   public function hasData();
28
29   /**
30    * Purges a batch of field data.
31    *
32    * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
33    *   The deleted field whose data is being purged.
34    * @param $batch_size
35    *   The maximum number of field data records to purge before returning,
36    *   relating to the count of field data records returned by
37    *   \Drupal\Core\Entity\FieldableEntityStorageInterface::countFieldData().
38    *
39    * @return int
40    *   The number of field data records that have been purged.
41    */
42   public function purgeFieldData(FieldDefinitionInterface $field_definition, $batch_size);
43
44   /**
45    * Performs final cleanup after all data of a field has been purged.
46    *
47    * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition
48    *   The field being purged.
49    */
50   public function finalizePurge(FieldStorageDefinitionInterface $storage_definition);
51
52 }