function EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Entity/EntityLastInstalledSchemaRepositoryInterface.php \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition()
- 10 core/lib/Drupal/Core/Entity/EntityLastInstalledSchemaRepositoryInterface.php \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition()
- 11.x core/lib/Drupal/Core/Entity/EntityLastInstalledSchemaRepositoryInterface.php \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition()
Gets the entity type definition in its most recently installed state.
During the application lifetime, entity type definitions can change. For example, updated code can be deployed. The getDefinition() method will always return the definition as determined by the current codebase. This method, however, returns what the definition was when the last time that one of the \Drupal\Core\Entity\EntityTypeListenerInterface events was last fired and completed successfully. In other words, the definition that the entity type's handlers have incorporated into the application state. For example, if the entity type's storage handler is SQL-based, the definition for which database tables were created.
Application management code can check if getDefinition() differs from getLastInstalledDefinition() and decide whether to:
- Invoke the appropriate \Drupal\Core\Entity\EntityTypeListenerInterface event so that handlers react to the new definition.
- Raise a warning that the application state is incompatible with the codebase.
- Perform some other action.
Parameters
string $entity_type_id: The entity type ID.
Return value
\Drupal\Core\Entity\EntityTypeInterface|null The installed entity type definition, or NULL if the entity type has not yet been installed via onEntityTypeCreate().
See also
\Drupal\Core\Entity\EntityTypeListenerInterface
1 method overrides EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition()
- EntityLastInstalledSchemaRepository::getLastInstalledDefinition in core/
lib/ Drupal/ Core/ Entity/ EntityLastInstalledSchemaRepository.php - Gets the entity type definition in its most recently installed state.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityLastInstalledSchemaRepositoryInterface.php, line 42
Class
- EntityLastInstalledSchemaRepositoryInterface
- Provides an interface for an installed entity definition repository.
Namespace
Drupal\Core\EntityCode
public function getLastInstalledDefinition($entity_type_id);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.