public function EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition

public EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition($entity_type_id)

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:

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

File

core/lib/Drupal/Core/Entity/EntityLastInstalledSchemaRepositoryInterface.php, line 42

Class

EntityLastInstalledSchemaRepositoryInterface
Provides an interface for an installed entity definition repository.

Namespace

Drupal\Core\Entity

Code

public function getLastInstalledDefinition($entity_type_id);

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityLastInstalledSchemaRepositoryInterface.php/function/EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition/8.1.x