function EntityTestDefinitionSubscriber::onEntityTypeCreate
Same name in other branches
- 9 core/modules/system/tests/modules/entity_test/src/EntityTestDefinitionSubscriber.php \Drupal\entity_test\EntityTestDefinitionSubscriber::onEntityTypeCreate()
- 10 core/modules/system/tests/modules/entity_test/src/EntityTestDefinitionSubscriber.php \Drupal\entity_test\EntityTestDefinitionSubscriber::onEntityTypeCreate()
- 11.x core/modules/system/tests/modules/entity_test/src/EntityTestDefinitionSubscriber.php \Drupal\entity_test\EntityTestDefinitionSubscriber::onEntityTypeCreate()
Overrides EntityTypeEventSubscriberTrait::onEntityTypeCreate
File
-
core/
modules/ system/ tests/ modules/ entity_test/ src/ EntityTestDefinitionSubscriber.php, line 89
Class
- EntityTestDefinitionSubscriber
- Test entity type and field storage definition event subscriber.
Namespace
Drupal\entity_testCode
public function onEntityTypeCreate(EntityTypeInterface $entity_type) {
if ($this->entityLastInstalledSchemaRepository
->getLastInstalledDefinition($entity_type->id())) {
$this->storeDefinitionUpdate(EntityTypeEvents::CREATE);
}
$this->storeEvent(EntityTypeEvents::CREATE);
// Retrieve the live entity type definition in order to warm the static
// cache and then insert the new entity type definition, so we can test that
// the cache doesn't get stale after the event has fired.
if ($this->updateLiveDefinitions) {
$this->entityTypeManager
->getDefinition($entity_type->id());
$this->state
->set('entity_test_rev.entity_type', $entity_type);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.