function EntityTestDefinitionSubscriber::onFieldStorageDefinitionDelete
Same name in other branches
- 9 core/modules/system/tests/modules/entity_test/src/EntityTestDefinitionSubscriber.php \Drupal\entity_test\EntityTestDefinitionSubscriber::onFieldStorageDefinitionDelete()
- 8.9.x core/modules/system/tests/modules/entity_test/src/EntityTestDefinitionSubscriber.php \Drupal\entity_test\EntityTestDefinitionSubscriber::onFieldStorageDefinitionDelete()
- 11.x core/modules/system/tests/modules/entity_test/src/EntityTestDefinitionSubscriber.php \Drupal\entity_test\EntityTestDefinitionSubscriber::onFieldStorageDefinitionDelete()
Overrides FieldStorageDefinitionEventSubscriberTrait::onFieldStorageDefinitionDelete
File
-
core/
modules/ system/ tests/ modules/ entity_test/ src/ EntityTestDefinitionSubscriber.php, line 196
Class
- EntityTestDefinitionSubscriber
- Test entity type and field storage definition event subscriber.
Namespace
Drupal\entity_testCode
public function onFieldStorageDefinitionDelete(FieldStorageDefinitionInterface $storage_definition) {
if (!isset($this->entityLastInstalledSchemaRepository
->getLastInstalledFieldStorageDefinitions($storage_definition->getTargetEntityTypeId())[$storage_definition->getName()])) {
$this->storeDefinitionUpdate(FieldStorageDefinitionEvents::DELETE);
}
$this->storeEvent(FieldStorageDefinitionEvents::DELETE);
// Retrieve the live field storage definitions in order to warm the static
// cache and then remove the new storage definition, so we can test that the
// cache doesn't get stale after the event has fired.
if ($this->updateLiveDefinitions) {
$this->entityFieldManager
->getFieldStorageDefinitions($storage_definition->getTargetEntityTypeId());
$this->state
->set('entity_test_rev.additional_base_field_definitions', []);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.