FieldableEntityStorageInterface.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace Drupal\Core\Entity;
  3. use Drupal\Core\Field\FieldDefinitionInterface;
  4. use Drupal\Core\Field\FieldStorageDefinitionInterface;
  5. /**
  6. * A storage that supports entity types with field definitions.
  7. */
  8. interface FieldableEntityStorageInterface extends EntityStorageInterface {
  9. /**
  10. * Determines the number of entities with values for a given field.
  11. *
  12. * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition
  13. * The field for which to count data records.
  14. * @param bool $as_bool
  15. * (Optional) Optimises the query for checking whether there are any records
  16. * or not. Defaults to FALSE.
  17. *
  18. * @return bool|int
  19. * The number of entities. If $as_bool parameter is TRUE then the
  20. * value will either be TRUE or FALSE.
  21. *
  22. * @see \Drupal\Core\Entity\FieldableEntityStorageInterface::purgeFieldData()
  23. */
  24. public function countFieldData($storage_definition, $as_bool = FALSE);
  25. /**
  26. * Purges a batch of field data.
  27. *
  28. * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
  29. * The deleted field whose data is being purged.
  30. * @param int $batch_size
  31. * The maximum number of field data records to purge before returning,
  32. * relating to the count of field data records returned by
  33. * \Drupal\Core\Entity\FieldableEntityStorageInterface::countFieldData().
  34. *
  35. * @return int
  36. * The number of field data records that have been purged.
  37. */
  38. public function purgeFieldData(FieldDefinitionInterface $field_definition, $batch_size);
  39. /**
  40. * Performs final cleanup after all data of a field has been purged.
  41. *
  42. * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition
  43. * The field storage being purged.
  44. */
  45. public function finalizePurge(FieldStorageDefinitionInterface $storage_definition);
  46. }