From ba509afbc9ab563fb55cae3c35c2b0aee18cae3d Mon Sep 17 00:00:00 2001
From: Lee Rowlands <lee.rowlands@previousnext.com.au>
Date: Fri, 24 May 2019 16:44:36 +1000
Subject: [PATCH] Issue #3047866 by mikelutz, Berdir, TR, alexpott, andypost,
 Satyanarayan Reddy: Remove usage of deprecated \Drupal::entityManager() in
 core

---
 core/core.api.php                             |  2 +-
 core/includes/install.core.inc                |  2 +-
 core/lib/Drupal.php                           |  1 +
 .../Core/Entity/Entity/EntityFormDisplay.php  |  2 +-
 .../Core/Entity/Entity/EntityViewDisplay.php  |  6 +--
 .../Core/Entity/EntityDisplayModeBase.php     |  2 +-
 .../Drupal/Core/Entity/EntityStorageBase.php  |  2 +-
 core/lib/Drupal/Core/Entity/EntityType.php    |  2 +-
 .../Drupal/Core/Entity/EntityTypeManager.php  |  2 +-
 .../EntityChangedConstraintValidator.php      |  2 +-
 .../ReferenceAccessConstraintValidator.php    |  2 +-
 .../Entity/TypedData/EntityDataDefinition.php |  2 +-
 core/lib/Drupal/Core/Entity/entity.api.php    |  4 +-
 core/lib/Drupal/Core/Extension/module.api.php |  2 +-
 .../Core/Field/Entity/BaseFieldOverride.php   |  4 +-
 .../Field/EntityReferenceFieldItemList.php    |  6 +--
 core/lib/Drupal/Core/Field/FieldItemBase.php  |  2 +-
 core/lib/Drupal/Core/Field/FieldItemList.php  |  4 +-
 .../EntityReferenceEntityFormatter.php        |  2 +-
 .../EntityReferenceFormatterBase.php          |  2 +-
 core/lib/Drupal/Core/Menu/menu.api.php        |  2 +-
 core/lib/Drupal/Core/Session/AccountProxy.php |  2 +-
 core/lib/Drupal/Core/Session/UserSession.php  |  2 +-
 core/modules/aggregator/aggregator.module     |  2 +-
 core/modules/aggregator/src/Entity/Feed.php   |  2 +-
 .../Functional/FeedProcessorPluginTest.php    |  2 +-
 core/modules/block/block.post_update.php      |  2 +-
 .../BlockContentTranslationUITest.php         |  2 +-
 .../tests/src/Functional/PageEditTest.php     |  2 +-
 core/modules/book/book.module                 |  2 +-
 .../src/Functional/BookBreadcrumbTest.php     |  2 +-
 .../book/tests/src/Functional/BookTest.php    |  6 +--
 .../tests/src/Functional/BookTestTrait.php    |  2 +-
 .../Functional/Views/BookRelationshipTest.php |  2 +-
 core/modules/comment/comment.module           | 12 ++---
 core/modules/comment/comment.views.inc        |  2 +-
 core/modules/comment/src/CommentViewsData.php |  2 +-
 .../Plugin/views/field/NodeNewComments.php    | 47 ++++++++++++++++---
 .../comment/src/Tests/CommentTestBase.php     |  2 +-
 .../tests/src/Functional/CommentPagerTest.php |  6 +--
 .../src/Functional/CommentPreviewTest.php     |  2 +-
 .../tests/src/Functional/CommentTestBase.php  |  2 +-
 .../Functional/CommentTranslationUITest.php   |  4 +-
 .../tests/src/Functional/CommentTypeTest.php  |  2 +-
 .../CommentDefaultFormatterCacheTagsTest.php  |  6 +--
 .../src/Kernel/CommentValidationTest.php      |  2 +-
 .../Kernel/Migrate/MigrateCommentStubTest.php |  2 +-
 .../src/Kernel/Views/CommentUserNameTest.php  |  2 +-
 .../ConfigEntityListMultilingualTest.php      |  2 +-
 .../src/Functional/ConfigEntityListTest.php   |  6 +--
 .../ConfigInstallProfileOverrideTest.php      |  4 +-
 .../ConfigSingleImportExportTest.php          |  4 +-
 .../config_translation.api.php                |  4 +-
 .../config_translation.module                 |  6 +--
 .../ConfigTranslationOverviewTest.php         |  2 +-
 .../tests/src/Kernel/MessageEntityTest.php    |  4 +-
 .../content_translation.module                |  6 +--
 .../src/Tests/ContentTranslationTestBase.php  |  6 +--
 .../ContentTranslationOperationsTest.php      |  2 +-
 .../Functional/ContentTranslationTestBase.php |  4 +-
 core/modules/editor/editor.module             |  2 +-
 core/modules/editor/src/Entity/Editor.php     |  2 +-
 .../src/Kernel/EditorImageDialogTest.php      |  2 +-
 core/modules/field/field.module               |  8 ++--
 core/modules/field/field.purge.inc            |  6 +--
 .../field/src/ConfigImporterFieldPurger.php   |  4 +-
 core/modules/field/src/Entity/FieldConfig.php |  7 ++-
 .../field/src/Entity/FieldStorageConfig.php   | 12 ++---
 .../EntityReferenceIntegrationTest.php        |  2 +-
 .../EntityReferenceAdminTest.php              |  2 +-
 .../field/tests/src/Kernel/BulkDeleteTest.php |  2 +-
 .../EntityReferenceFormatterTest.php          |  2 +-
 .../EntityReferenceItemTest.php               |  2 +-
 .../tests/src/Kernel/FieldAttachOtherTest.php |  2 +-
 .../src/Kernel/FieldAttachStorageTest.php     |  2 +-
 .../tests/src/Kernel/FieldDataCountTest.php   |  8 ++--
 .../src/Kernel/FieldImportDeleteTest.php      | 10 ++--
 .../tests/src/Kernel/FieldKernelTestBase.php  |  2 +-
 .../Timestamp/TimestampFormatterTest.php      |  2 +-
 .../tests/src/Kernel/TranslationTest.php      |  4 +-
 core/modules/field_ui/field_ui.module         |  2 +-
 core/modules/field_ui/src/FieldUI.php         |  2 +-
 core/modules/file/file.module                 |  8 ++--
 core/modules/file/file.views.inc              |  2 +-
 .../Field/FieldType/FileFieldItemList.php     |  2 +-
 .../Functional/FileManagedFileElementTest.php |  2 +-
 .../tests/src/Functional/FilePrivateTest.php  |  4 +-
 .../PrivateFileOnTranslatedEntityTest.php     |  4 +-
 core/modules/filter/filter.module             |  4 +-
 .../filter/tests/src/Kernel/FilterAPITest.php |  4 +-
 core/modules/forum/forum.module               |  2 +-
 core/modules/image/image.views.inc            |  6 +--
 .../src/Plugin/Field/FieldType/ImageItem.php  |  2 +-
 .../Plugin/Field/FieldWidget/ImageWidget.php  |  2 +-
 .../src/Functional/JsonApiFunctionalTest.php  |  2 +-
 core/modules/language/language.module         |  2 +-
 .../src/Entity/ContentLanguageSettings.php    |  4 +-
 .../LanguageConfigurationElementTest.php      |  6 +--
 .../menu_link_content.module                  |  4 +-
 .../menu_ui/src/Tests/MenuWebTestBase.php     |  4 +-
 .../src/Functional/MenuUninstallTest.php      |  2 +-
 .../modules/migrate/src/MigrateExecutable.php |  6 +--
 .../src/Tests/StubTestTrait.php               |  2 +-
 core/modules/node/node.install                |  2 +-
 core/modules/node/node.module                 | 22 ++++-----
 core/modules/node/src/Entity/Node.php         |  2 +-
 core/modules/node/src/Tests/NodeTestBase.php  |  2 +-
 .../src/Functional/NodeAccessPagerTest.php    |  2 +-
 .../tests/src/Functional/NodeCreationTest.php |  4 +-
 .../tests/src/Functional/NodeEditFormTest.php |  2 +-
 .../tests/src/Functional/NodeSaveTest.php     |  2 +-
 .../NodeTemplateSuggestionsTest.php           |  4 +-
 .../tests/src/Functional/NodeTestBase.php     |  2 +-
 .../src/Functional/NodeTranslationUITest.php  |  4 +-
 .../Functional/Views/BulkFormAccessTest.php   |  2 +-
 .../Views/NodeRevisionWizardTest.php          |  2 +-
 .../Migrate/d6/MigrateNodeRevisionTest.php    |  4 +-
 .../src/Kernel/Migrate/d6/MigrateNodeTest.php |  2 +-
 .../src/Kernel/Migrate/d7/MigrateNodeTest.php |  2 +-
 .../src/Kernel/NodeAccessLanguageTest.php     |  8 ++--
 .../QuickEditLoadingTest.php                  |  4 +-
 core/modules/rdf/src/Entity/RdfMapping.php    |  6 +--
 .../SearchConfigSettingsFormTest.php          |  2 +-
 .../src/Kernel/EntitySerializationTest.php    |  2 +-
 core/modules/shortcut/shortcut.api.php        |  2 +-
 core/modules/shortcut/shortcut.module         | 12 ++---
 .../shortcut/src/Entity/ShortcutSet.php       |  4 +-
 .../shortcut/src/Tests/ShortcutTestBase.php   |  4 +-
 .../tests/src/Functional/ShortcutSetsTest.php |  6 +--
 .../tests/src/Functional/ShortcutTestBase.php |  4 +-
 .../src/Tests/KernelTestBaseTest.php          |  2 +-
 .../Tests/Entity/EntityCacheTagsTestBase.php  | 12 ++---
 .../Entity/EntityWithUriCacheTagsTestBase.php |  4 +-
 core/modules/system/system.install            |  8 ++--
 .../modules/entity_test/entity_test.module    |  6 +--
 .../Datetime/DrupalDateTimeTest.php           |  2 +-
 .../Entity/EntityCacheTagsTestBase.php        | 12 ++---
 .../Entity/EntityWithUriCacheTagsTestBase.php |  4 +-
 ...ntEntityStorageSchemaConverterTestBase.php |  8 ----
 .../src/Functional/Menu/LocalTasksTest.php    |  2 +-
 .../Module/InstallUninstallTest.php           |  2 +-
 .../src/Functional/Module/UninstallTest.php   |  2 +-
 .../src/Functional/System/DateTimeTest.php    |  2 +-
 ...sAndTasksConvertedIntoBlocksUpdateTest.php |  2 +-
 .../PageTitleConvertedIntoBlockUpdateTest.php |  2 +-
 ...LocalTasksConvertedIntoBlockUpdateTest.php |  2 +-
 ...teBrandingConvertedIntoBlockUpdateTest.php |  2 +-
 .../Update/UpdatePathRC1TestBaseTest.php      |  2 +-
 .../Kernel/Extension/ModuleHandlerTest.php    |  2 +-
 .../Plugin/views/field/TaxonomyIndexTid.php   |  2 +-
 core/modules/taxonomy/taxonomy.module         |  6 +--
 core/modules/taxonomy/taxonomy.tokens.inc     |  2 +-
 .../src/Functional/TaxonomyQueryAlterTest.php |  2 +-
 .../TaxonomyTermIndentationTest.php           |  2 +-
 .../Migrate/d6/MigrateTaxonomyTermTest.php    |  2 +-
 .../d6/MigrateTermNodeRevisionTest.php        |  2 +-
 .../Migrate/d7/MigrateTaxonomyTermTest.php    |  2 +-
 .../tests/src/Kernel/TermKernelTest.php       |  2 +-
 core/modules/tracker/tracker.pages.inc        |  2 +-
 core/modules/user/src/Entity/User.php         |  6 +--
 .../tests/src/Functional/UserCancelTest.php   |  6 +--
 .../src/Functional/UserPasswordResetTest.php  |  2 +-
 .../src/Functional/UserPermissionsTest.php    |  4 +-
 .../src/Functional/UserRegistrationTest.php   |  2 +-
 .../src/Functional/UserRoleAdminTest.php      |  4 +-
 .../src/Functional/UserTranslationUITest.php  |  2 +-
 .../src/Functional/Views/AccessRoleTest.php   |  2 +-
 core/modules/user/user.install                |  2 +-
 core/modules/user/user.module                 |  8 ++--
 .../Plugin/views/cache/CachePluginBase.php    |  2 +-
 .../Plugin/views/query/QueryPluginBase.php    |  4 +-
 .../views/src/Plugin/views/query/Sql.php      |  2 +-
 .../Plugin/views/wizard/WizardPluginBase.php  |  2 +-
 core/modules/views/src/Tests/ViewTestData.php |  2 +-
 core/modules/views/src/Views.php              |  6 +--
 .../Handler/FieldEntityOperationsTest.php     |  2 +-
 .../src/Functional/Wizard/NodeWizardTest.php  |  2 +-
 .../Kernel/Entity/RowEntityRenderersTest.php  |  2 +-
 .../src/Kernel/Handler/AreaEntityTest.php     |  2 +-
 .../Handler/FieldFieldAccessTestBase.php      |  2 +-
 .../tests/src/Kernel/ViewStorageTest.php      |  2 +-
 core/modules/views/views.api.php              |  8 ++--
 core/modules/views/views.module               |  2 +-
 core/modules/views/views.post_update.php      |  2 +-
 core/modules/views/views.views.inc            | 32 ++++++-------
 .../views_ui/src/Form/Ajax/ViewsFormBase.php  |  2 +-
 .../tests/src/Functional/DisplayPathTest.php  |  2 +-
 .../tests/src/Functional/ViewEditTest.php     |  2 +-
 .../Config/ConfigEntityStaticCacheTest.php    |  2 +-
 .../Core/Config/ConfigEntityUnitTest.php      |  2 +-
 .../Core/Config/ConfigImporterTest.php        | 10 ++--
 .../Core/Config/ConfigInstallTest.php         |  2 +-
 .../KernelTests/Core/Entity/EntityApiTest.php |  6 +--
 .../Core/Entity/EntitySchemaTest.php          |  2 +-
 .../Core/Entity/FieldSqlStorageTest.php       |  2 +-
 .../Entity/FieldTranslationSqlStorageTest.php |  2 +-
 .../FieldWidgetConstraintValidatorTest.php    |  4 +-
 .../RevisionableContentEntityBaseTest.php     |  2 +-
 .../Core/Menu/MenuLinkTreeTest.php            | 10 ++--
 core/tests/Drupal/Tests/Core/DrupalTest.php   |  2 +
 .../Tests/Core/Session/UserSessionTest.php    |  6 +--
 201 files changed, 402 insertions(+), 373 deletions(-)

diff --git a/core/core.api.php b/core/core.api.php
index 4f937e375fbc..cfb8800728e7 100644
--- a/core/core.api.php
+++ b/core/core.api.php
@@ -1914,7 +1914,7 @@ function hook_cron() {
   // Long-running operation example, leveraging a queue:
   // Queue news feeds for updates once their refresh interval has elapsed.
   $queue = \Drupal::queue('aggregator_feeds');
-  $ids = \Drupal::entityManager()->getStorage('aggregator_feed')->getFeedIdsToRefresh();
+  $ids = \Drupal::entityTypeManager()->getStorage('aggregator_feed')->getFeedIdsToRefresh();
   foreach (Feed::loadMultiple($ids) as $feed) {
     if ($queue->createItem($feed)) {
       // Add timestamp to avoid queueing item more than once.
diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index ffdaaf319e49..92bf908e7ace 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -1621,7 +1621,7 @@ function install_profile_modules(&$install_state) {
  */
 function install_core_entity_type_definitions() {
   $update_manager = \Drupal::entityDefinitionUpdateManager();
-  foreach (\Drupal::entityManager()->getDefinitions() as $entity_type) {
+  foreach (\Drupal::entityTypeManager()->getDefinitions() as $entity_type) {
     if ($entity_type->getProvider() == 'core') {
       $update_manager->installEntityType($entity_type);
     }
diff --git a/core/lib/Drupal.php b/core/lib/Drupal.php
index fbbfba7e0e8a..b33e0bc040b0 100644
--- a/core/lib/Drupal.php
+++ b/core/lib/Drupal.php
@@ -270,6 +270,7 @@ public static function currentUser() {
    *   correct interface or service.
    */
   public static function entityManager() {
+    @trigger_error("\Drupal::entityManager() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal::entityTypeManager() instead in most cases. If the needed method is not on \Drupal\Core\Entity\EntityTypeManagerInterface, see the deprecated \Drupal\Core\Entity\EntityManager to find the correct interface or service. See https://www.drupal.org/node/2549139", E_USER_DEPRECATED);
     return static::getContainer()->get('entity.manager');
   }
 
diff --git a/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php b/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php
index 3aabc9f5168b..26bdf67b32a5 100644
--- a/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php
+++ b/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php
@@ -96,7 +96,7 @@ public static function collectRenderDisplay(FieldableEntityInterface $entity, $f
       ->execute();
 
     // Load the first valid candidate display, if any.
-    $storage = \Drupal::entityManager()->getStorage('entity_form_display');
+    $storage = \Drupal::entityTypeManager()->getStorage('entity_form_display');
     foreach ($candidate_ids as $candidate_id) {
       if (isset($results[$candidate_id])) {
         $display = $storage->load($candidate_id);
diff --git a/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php b/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php
index 8ae9e72821a0..00800b583955 100644
--- a/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php
+++ b/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php
@@ -112,7 +112,7 @@ public static function collectRenderDisplays($entities, $view_mode) {
     }
 
     // Load the selected displays.
-    $storage = \Drupal::entityManager()->getStorage('entity_view_display');
+    $storage = \Drupal::entityTypeManager()->getStorage('entity_view_display');
     $displays = $storage->loadMultiple($load_ids);
 
     $displays_by_bundle = [];
@@ -182,8 +182,8 @@ public function __construct(array $values, $entity_type) {
   public function postSave(EntityStorageInterface $storage, $update = TRUE) {
     // Reset the render cache for the target entity type.
     parent::postSave($storage, $update);
-    if (\Drupal::entityManager()->hasHandler($this->targetEntityType, 'view_builder')) {
-      \Drupal::entityManager()->getViewBuilder($this->targetEntityType)->resetCache();
+    if (\Drupal::entityTypeManager()->hasHandler($this->targetEntityType, 'view_builder')) {
+      \Drupal::entityTypeManager()->getViewBuilder($this->targetEntityType)->resetCache();
     }
   }
 
diff --git a/core/lib/Drupal/Core/Entity/EntityDisplayModeBase.php b/core/lib/Drupal/Core/Entity/EntityDisplayModeBase.php
index c6ec9169e283..a611487fa1c7 100644
--- a/core/lib/Drupal/Core/Entity/EntityDisplayModeBase.php
+++ b/core/lib/Drupal/Core/Entity/EntityDisplayModeBase.php
@@ -86,7 +86,7 @@ public function setTargetType($target_entity_type) {
    */
   public function calculateDependencies() {
     parent::calculateDependencies();
-    $target_entity_type = \Drupal::entityManager()->getDefinition($this->targetEntityType);
+    $target_entity_type = \Drupal::entityTypeManager()->getDefinition($this->targetEntityType);
     $this->addDependency('module', $target_entity_type->getProvider());
     return $this;
   }
diff --git a/core/lib/Drupal/Core/Entity/EntityStorageBase.php b/core/lib/Drupal/Core/Entity/EntityStorageBase.php
index 2ceb19c2b1fc..1a27a7738acd 100644
--- a/core/lib/Drupal/Core/Entity/EntityStorageBase.php
+++ b/core/lib/Drupal/Core/Entity/EntityStorageBase.php
@@ -22,7 +22,7 @@ abstract class EntityStorageBase extends EntityHandlerBase implements EntityStor
    *
    * The following code returns the same object:
    * @code
-   * \Drupal::entityManager()->getDefinition($this->entityTypeId)
+   * \Drupal::entityTypeManager()->getDefinition($this->entityTypeId)
    * @endcode
    *
    * @var \Drupal\Core\Entity\EntityTypeInterface
diff --git a/core/lib/Drupal/Core/Entity/EntityType.php b/core/lib/Drupal/Core/Entity/EntityType.php
index 71aea12b8045..db0def37decd 100644
--- a/core/lib/Drupal/Core/Entity/EntityType.php
+++ b/core/lib/Drupal/Core/Entity/EntityType.php
@@ -910,7 +910,7 @@ public function getBundleConfigDependency($bundle) {
     // If this entity type uses entities to manage its bundles then depend on
     // the bundle entity.
     if ($bundle_entity_type_id = $this->getBundleEntityType()) {
-      if (!$bundle_entity = \Drupal::entityManager()->getStorage($bundle_entity_type_id)->load($bundle)) {
+      if (!$bundle_entity = \Drupal::entityTypeManager()->getStorage($bundle_entity_type_id)->load($bundle)) {
         throw new \LogicException(sprintf('Missing bundle entity, entity type %s, entity id %s.', $bundle_entity_type_id, $bundle));
       }
       $config_dependency = [
diff --git a/core/lib/Drupal/Core/Entity/EntityTypeManager.php b/core/lib/Drupal/Core/Entity/EntityTypeManager.php
index 5544e4a43db5..6ae723f8d793 100644
--- a/core/lib/Drupal/Core/Entity/EntityTypeManager.php
+++ b/core/lib/Drupal/Core/Entity/EntityTypeManager.php
@@ -232,7 +232,7 @@ public function getFormObject($entity_type_id, $operation) {
       ->setOperation($operation)
       // The entity manager cannot be injected due to a circular dependency.
       // @todo Remove this set call in https://www.drupal.org/node/2603542.
-      ->setEntityManager(\Drupal::entityManager());
+      ->setEntityManager(\Drupal::service('entity.manager'));
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityChangedConstraintValidator.php b/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityChangedConstraintValidator.php
index 28d81ba6e4de..5a7b4b90c63f 100644
--- a/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityChangedConstraintValidator.php
+++ b/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityChangedConstraintValidator.php
@@ -17,7 +17,7 @@ public function validate($entity, Constraint $constraint) {
     if (isset($entity)) {
       /** @var \Drupal\Core\Entity\EntityInterface $entity */
       if (!$entity->isNew()) {
-        $saved_entity = \Drupal::entityManager()->getStorage($entity->getEntityTypeId())->loadUnchanged($entity->id());
+        $saved_entity = \Drupal::entityTypeManager()->getStorage($entity->getEntityTypeId())->loadUnchanged($entity->id());
         // Ensure that all the entity translations are the same as or newer
         // than their current version in the storage in order to avoid
         // reverting other changes. In fact the entity object that is being
diff --git a/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ReferenceAccessConstraintValidator.php b/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ReferenceAccessConstraintValidator.php
index 7860c90d6542..eec95bca50af 100644
--- a/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ReferenceAccessConstraintValidator.php
+++ b/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ReferenceAccessConstraintValidator.php
@@ -29,7 +29,7 @@ public function validate($value, Constraint $constraint) {
       $entity = $value->getEntity();
       $check_permission = TRUE;
       if (!$entity->isNew()) {
-        $existing_entity = \Drupal::entityManager()->getStorage($entity->getEntityTypeId())->loadUnchanged($entity->id());
+        $existing_entity = \Drupal::entityTypeManager()->getStorage($entity->getEntityTypeId())->loadUnchanged($entity->id());
         $referenced_entities = $existing_entity->{$value->getFieldDefinition()->getName()}->referencedEntities();
         // Check permission if we are not already referencing the entity.
         foreach ($referenced_entities as $ref) {
diff --git a/core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php b/core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php
index cbd2b00f3467..74463ee2c3c7 100644
--- a/core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php
+++ b/core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php
@@ -70,7 +70,7 @@ public function getPropertyDefinitions() {
     if (!isset($this->propertyDefinitions)) {
       if ($entity_type_id = $this->getEntityTypeId()) {
         // Return an empty array for entities that are not content entities.
-        $entity_type_class = \Drupal::entityManager()->getDefinition($entity_type_id)->getClass();
+        $entity_type_class = \Drupal::entityTypeManager()->getDefinition($entity_type_id)->getClass();
         if (!in_array('Drupal\Core\Entity\FieldableEntityInterface', class_implements($entity_type_class))) {
           $this->propertyDefinitions = [];
         }
diff --git a/core/lib/Drupal/Core/Entity/entity.api.php b/core/lib/Drupal/Core/Entity/entity.api.php
index 846c757128dd..74ddd1b4d700 100644
--- a/core/lib/Drupal/Core/Entity/entity.api.php
+++ b/core/lib/Drupal/Core/Entity/entity.api.php
@@ -580,7 +580,7 @@
  * implementing \Drupal\Core\Entity\EntityViewBuilderInterface that you can
  * retrieve with:
  * @code
- * $view_builder = \Drupal::entityManager()->getViewBuilder('your_entity_type');
+ * $view_builder = \Drupal::entityTypeManager()->getViewBuilder('your_entity_type');
  * // Or if you have a $container variable:
  * $view_builder = $container->get('entity.manager')->getViewBuilder('your_entity_type');
  * @endcode
@@ -1943,7 +1943,7 @@ function hook_entity_bundle_field_info_alter(&$fields, \Drupal\Core\Entity\Entit
  * @see \Drupal\Core\Entity\EntityManagerInterface::getFieldStorageDefinitions()
  */
 function hook_entity_field_storage_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) {
-  if (\Drupal::entityManager()->getStorage($entity_type->id()) instanceof DynamicallyFieldableEntityStorageInterface) {
+  if (\Drupal::entityTypeManager()->getStorage($entity_type->id()) instanceof DynamicallyFieldableEntityStorageInterface) {
     // Query by filtering on the ID as this is more efficient than filtering
     // on the entity_type property directly.
     $ids = \Drupal::entityQuery('field_storage_config')
diff --git a/core/lib/Drupal/Core/Extension/module.api.php b/core/lib/Drupal/Core/Extension/module.api.php
index 572ba8a3af8e..74580705f6f2 100644
--- a/core/lib/Drupal/Core/Extension/module.api.php
+++ b/core/lib/Drupal/Core/Extension/module.api.php
@@ -729,7 +729,7 @@ function hook_post_update_NAME(&$sandbox) {
   $block_update_8001 = \Drupal::keyValue('update_backup')->get('block_update_8001', []);
 
   $block_ids = array_keys($block_update_8001);
-  $block_storage = \Drupal::entityManager()->getStorage('block');
+  $block_storage = \Drupal::entityTypeManager()->getStorage('block');
   $blocks = $block_storage->loadMultiple($block_ids);
   /** @var $blocks \Drupal\block\BlockInterface[] */
   foreach ($blocks as $block) {
diff --git a/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php b/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php
index 7ffb8ba57b88..1178cb007b96 100644
--- a/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php
+++ b/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php
@@ -64,7 +64,7 @@ public static function createFromBaseFieldDefinition(BaseFieldDefinition $base_f
     $values = $base_field_definition->toArray();
     $values['bundle'] = $bundle;
     $values['baseFieldDefinition'] = $base_field_definition;
-    return \Drupal::entityManager()->getStorage('base_field_override')->create($values);
+    return \Drupal::entityTypeManager()->getStorage('base_field_override')->create($values);
   }
 
   /**
@@ -238,7 +238,7 @@ public static function postDelete(EntityStorageInterface $storage, array $field_
    *   provided field name, otherwise NULL.
    */
   public static function loadByName($entity_type_id, $bundle, $field_name) {
-    return \Drupal::entityManager()->getStorage('base_field_override')->load($entity_type_id . '.' . $bundle . '.' . $field_name);
+    return \Drupal::entityTypeManager()->getStorage('base_field_override')->load($entity_type_id . '.' . $bundle . '.' . $field_name);
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php b/core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php
index 3fa199b72764..07449e8e9137 100644
--- a/core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php
+++ b/core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php
@@ -43,7 +43,7 @@ public function referencedEntities() {
     // Load and add the existing entities.
     if ($ids) {
       $target_type = $this->getFieldDefinition()->getSetting('target_type');
-      $entities = \Drupal::entityManager()->getStorage($target_type)->loadMultiple($ids);
+      $entities = \Drupal::entityTypeManager()->getStorage($target_type)->loadMultiple($ids);
       foreach ($ids as $delta => $target_id) {
         if (isset($entities[$target_id])) {
           $target_entities[$delta] = $entities[$target_id];
@@ -75,7 +75,7 @@ public static function processDefaultValue($default_value, FieldableEntityInterf
         $entity_ids = \Drupal::entityQuery($target_type)
           ->condition('uuid', $uuids, 'IN')
           ->execute();
-        $entities = \Drupal::entityManager()
+        $entities = \Drupal::entityTypeManager()
           ->getStorage($target_type)
           ->loadMultiple($entity_ids);
 
@@ -117,7 +117,7 @@ public function defaultValuesFormSubmit(array $element, array &$form, FormStateI
       }
       $ids[] = $default_value[$delta]['target_id'];
     }
-    $entities = \Drupal::entityManager()
+    $entities = \Drupal::entityTypeManager()
       ->getStorage($this->getSetting('target_type'))
       ->loadMultiple($ids);
 
diff --git a/core/lib/Drupal/Core/Field/FieldItemBase.php b/core/lib/Drupal/Core/Field/FieldItemBase.php
index 5aa4ad11d3c0..a6e4092a8588 100644
--- a/core/lib/Drupal/Core/Field/FieldItemBase.php
+++ b/core/lib/Drupal/Core/Field/FieldItemBase.php
@@ -184,7 +184,7 @@ public function __unset($name) {
    * {@inheritdoc}
    */
   public function view($display_options = []) {
-    $view_builder = \Drupal::entityManager()->getViewBuilder($this->getEntity()->getEntityTypeId());
+    $view_builder = \Drupal::entityTypeManager()->getViewBuilder($this->getEntity()->getEntityTypeId());
     return $view_builder->viewFieldItem($this, $display_options);
   }
 
diff --git a/core/lib/Drupal/Core/Field/FieldItemList.php b/core/lib/Drupal/Core/Field/FieldItemList.php
index 5dd4f376bf21..ae7298e43cf8 100644
--- a/core/lib/Drupal/Core/Field/FieldItemList.php
+++ b/core/lib/Drupal/Core/Field/FieldItemList.php
@@ -150,7 +150,7 @@ public function __unset($property_name) {
    * {@inheritdoc}
    */
   public function access($operation = 'view', AccountInterface $account = NULL, $return_as_object = FALSE) {
-    $access_control_handler = \Drupal::entityManager()->getAccessControlHandler($this->getEntity()->getEntityTypeId());
+    $access_control_handler = \Drupal::entityTypeManager()->getAccessControlHandler($this->getEntity()->getEntityTypeId());
     return $access_control_handler->fieldAccess($operation, $this->getFieldDefinition(), $account, $this, $return_as_object);
   }
 
@@ -239,7 +239,7 @@ protected function delegateMethod($method) {
    * {@inheritdoc}
    */
   public function view($display_options = []) {
-    $view_builder = \Drupal::entityManager()->getViewBuilder($this->getEntity()->getEntityTypeId());
+    $view_builder = \Drupal::entityTypeManager()->getViewBuilder($this->getEntity()->getEntityTypeId());
     return $view_builder->viewField($this, $display_options);
   }
 
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
index 9333d7e22755..b04cf9d91d96 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
@@ -213,7 +213,7 @@ public static function isApplicable(FieldDefinitionInterface $field_definition)
     // This formatter is only available for entity types that have a view
     // builder.
     $target_type = $field_definition->getFieldStorageDefinition()->getSetting('target_type');
-    return \Drupal::entityManager()->getDefinition($target_type)->hasViewBuilderClass();
+    return \Drupal::entityTypeManager()->getDefinition($target_type)->hasViewBuilderClass();
   }
 
 }
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php
index d2a691f07733..1db3f0ed9afb 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php
@@ -136,7 +136,7 @@ public function prepareView(array $entities_items) {
     }
     if ($ids) {
       $target_type = $this->getFieldSetting('target_type');
-      $target_entities = \Drupal::entityManager()->getStorage($target_type)->loadMultiple($ids);
+      $target_entities = \Drupal::entityTypeManager()->getStorage($target_type)->loadMultiple($ids);
     }
 
     // For each item, pre-populate the loaded entity in $item->entity, and set
diff --git a/core/lib/Drupal/Core/Menu/menu.api.php b/core/lib/Drupal/Core/Menu/menu.api.php
index 4951c232db3d..758013f494e0 100644
--- a/core/lib/Drupal/Core/Menu/menu.api.php
+++ b/core/lib/Drupal/Core/Menu/menu.api.php
@@ -400,7 +400,7 @@ function hook_contextual_links_alter(array &$links, $group, array $route_paramet
   if ($group == 'menu') {
     // Dynamically use the menu name for the title of the menu_edit contextual
     // link.
-    $menu = \Drupal::entityManager()->getStorage('menu')->load($route_parameters['menu']);
+    $menu = \Drupal::entityTypeManager()->getStorage('menu')->load($route_parameters['menu']);
     $links['menu_edit']['title'] = t('Edit menu: @label', ['@label' => $menu->label()]);
   }
 }
diff --git a/core/lib/Drupal/Core/Session/AccountProxy.php b/core/lib/Drupal/Core/Session/AccountProxy.php
index 147bb62a772f..bc7f554c33d3 100644
--- a/core/lib/Drupal/Core/Session/AccountProxy.php
+++ b/core/lib/Drupal/Core/Session/AccountProxy.php
@@ -195,7 +195,7 @@ public function setInitialAccountId($account_id) {
    *   An account or NULL if none is found.
    */
   protected function loadUserEntity($account_id) {
-    return \Drupal::entityManager()->getStorage('user')->load($account_id);
+    return \Drupal::entityTypeManager()->getStorage('user')->load($account_id);
   }
 
 }
diff --git a/core/lib/Drupal/Core/Session/UserSession.php b/core/lib/Drupal/Core/Session/UserSession.php
index ec002beb7323..ba3b929a4c77 100644
--- a/core/lib/Drupal/Core/Session/UserSession.php
+++ b/core/lib/Drupal/Core/Session/UserSession.php
@@ -203,7 +203,7 @@ public function getLastAccessedTime() {
    *   The role storage object.
    */
   protected function getRoleStorage() {
-    return \Drupal::entityManager()->getStorage('user_role');
+    return \Drupal::entityTypeManager()->getStorage('user_role');
   }
 
 }
diff --git a/core/modules/aggregator/aggregator.module b/core/modules/aggregator/aggregator.module
index 74e795efaede..082681ed7624 100644
--- a/core/modules/aggregator/aggregator.module
+++ b/core/modules/aggregator/aggregator.module
@@ -143,7 +143,7 @@ function aggregator_entity_extra_field_info() {
 function aggregator_cron() {
   $queue = \Drupal::queue('aggregator_feeds');
 
-  $ids = \Drupal::entityManager()->getStorage('aggregator_feed')->getFeedIdsToRefresh();
+  $ids = \Drupal::entityTypeManager()->getStorage('aggregator_feed')->getFeedIdsToRefresh();
   foreach (Feed::loadMultiple($ids) as $feed) {
     if ($queue->createItem($feed)) {
       // Add timestamp to avoid queueing item more than once.
diff --git a/core/modules/aggregator/src/Entity/Feed.php b/core/modules/aggregator/src/Entity/Feed.php
index e653008458fe..4c3a5b856e15 100644
--- a/core/modules/aggregator/src/Entity/Feed.php
+++ b/core/modules/aggregator/src/Entity/Feed.php
@@ -125,7 +125,7 @@ public static function postDelete(EntityStorageInterface $storage, array $entiti
         ->condition('settings.feed', array_keys($entities))
         ->execute();
       if ($ids) {
-        $block_storage = \Drupal::entityManager()->getStorage('block');
+        $block_storage = \Drupal::entityTypeManager()->getStorage('block');
         $block_storage->delete($block_storage->loadMultiple($ids));
       }
     }
diff --git a/core/modules/aggregator/tests/src/Functional/FeedProcessorPluginTest.php b/core/modules/aggregator/tests/src/Functional/FeedProcessorPluginTest.php
index 8e6ade467ddf..2f95f69db96b 100644
--- a/core/modules/aggregator/tests/src/Functional/FeedProcessorPluginTest.php
+++ b/core/modules/aggregator/tests/src/Functional/FeedProcessorPluginTest.php
@@ -57,7 +57,7 @@ public function testPostProcess() {
     $this->updateFeedItems($feed);
     $feed_id = $feed->id();
     // Reset entity cache manually.
-    \Drupal::entityManager()->getStorage('aggregator_feed')->resetCache([$feed_id]);
+    \Drupal::entityTypeManager()->getStorage('aggregator_feed')->resetCache([$feed_id]);
     // Reload the feed to get new values.
     $feed = Feed::load($feed_id);
     // Make sure its refresh rate doubled.
diff --git a/core/modules/block/block.post_update.php b/core/modules/block/block.post_update.php
index 0d49ead480b4..e9e332ad086f 100644
--- a/core/modules/block/block.post_update.php
+++ b/core/modules/block/block.post_update.php
@@ -30,7 +30,7 @@ function block_post_update_disable_blocks_with_missing_contexts() {
   $block_update_8001 = \Drupal::keyValue('update_backup')->get('block_update_8001', []);
 
   $block_ids = array_keys($block_update_8001);
-  $block_storage = \Drupal::entityManager()->getStorage('block');
+  $block_storage = \Drupal::entityTypeManager()->getStorage('block');
   $blocks = $block_storage->loadMultiple($block_ids);
   /** @var $blocks \Drupal\block\BlockInterface[] */
   foreach ($blocks as $block) {
diff --git a/core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php b/core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php
index 9c2c1b44b795..c34e30f0854d 100644
--- a/core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php
+++ b/core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php
@@ -132,7 +132,7 @@ protected function doTestBasicTranslation() {
     // as in the original language.
     $default_langcode = $this->langcodes[0];
     $values = $this->getNewEntityValues($default_langcode);
-    $storage = \Drupal::entityManager()->getStorage($this->entityTypeId);
+    $storage = \Drupal::entityTypeManager()->getStorage($this->entityTypeId);
     /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
     $entity = $storage->create(['type' => 'basic'] + $values);
     $entity->save();
diff --git a/core/modules/block_content/tests/src/Functional/PageEditTest.php b/core/modules/block_content/tests/src/Functional/PageEditTest.php
index f623cfa28acb..e751c70b097a 100644
--- a/core/modules/block_content/tests/src/Functional/PageEditTest.php
+++ b/core/modules/block_content/tests/src/Functional/PageEditTest.php
@@ -57,7 +57,7 @@ public function testPageEdit() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
 
     // Ensure that the block revision has been created.
-    \Drupal::entityManager()->getStorage('block_content')->resetCache([$block->id()]);
+    \Drupal::entityTypeManager()->getStorage('block_content')->resetCache([$block->id()]);
     $revised_block = BlockContent::load($block->id());
     $this->assertNotIdentical($block->getRevisionId(), $revised_block->getRevisionId(), 'A new revision has been created.');
 
diff --git a/core/modules/book/book.module b/core/modules/book/book.module
index 7d703bae5115..8bb1bb38a5ac 100644
--- a/core/modules/book/book.module
+++ b/core/modules/book/book.module
@@ -96,7 +96,7 @@ function book_node_links_alter(array &$links, NodeInterface $node, array &$conte
     if (isset($node->book['depth'])) {
       if ($context['view_mode'] == 'full' && node_is_page($node)) {
         $child_type = \Drupal::config('book.settings')->get('child_type');
-        $access_control_handler = \Drupal::entityManager()->getAccessControlHandler('node');
+        $access_control_handler = \Drupal::entityTypeManager()->getAccessControlHandler('node');
         if (($account->hasPermission('add content to books') || $account->hasPermission('administer book outlines')) && $access_control_handler->createAccess($child_type) && $node->isPublished() && $node->book['depth'] < BookManager::BOOK_MAX_DEPTH) {
           $book_links['book_add_child'] = [
             'title' => t('Add child page'),
diff --git a/core/modules/book/tests/src/Functional/BookBreadcrumbTest.php b/core/modules/book/tests/src/Functional/BookBreadcrumbTest.php
index a863ff1529fc..5271c8e7b87d 100644
--- a/core/modules/book/tests/src/Functional/BookBreadcrumbTest.php
+++ b/core/modules/book/tests/src/Functional/BookBreadcrumbTest.php
@@ -118,7 +118,7 @@ protected function createBookNode($book_nid, $parent = NULL) {
       $edit['book[pid]'] = $parent;
       $this->drupalPostForm(NULL, $edit, t('Save'));
       // Make sure the parent was flagged as having children.
-      $parent_node = \Drupal::entityManager()->getStorage('node')->loadUnchanged($parent);
+      $parent_node = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($parent);
       $this->assertFalse(empty($parent_node->book['has_children']), 'Parent node is marked as having children');
     }
     else {
diff --git a/core/modules/book/tests/src/Functional/BookTest.php b/core/modules/book/tests/src/Functional/BookTest.php
index 972c240ceb53..92dfa00425a2 100644
--- a/core/modules/book/tests/src/Functional/BookTest.php
+++ b/core/modules/book/tests/src/Functional/BookTest.php
@@ -405,7 +405,7 @@ public function testBookOutline() {
     $edit = [];
     $edit['book[bid]'] = '1';
     $this->drupalPostForm('node/' . $empty_book->id() . '/outline', $edit, t('Add to book outline'));
-    $node = \Drupal::entityManager()->getStorage('node')->load($empty_book->id());
+    $node = \Drupal::entityTypeManager()->getStorage('node')->load($empty_book->id());
     // Test the book array.
     $this->assertEqual($node->book['nid'], $empty_book->id());
     $this->assertEqual($node->book['bid'], $empty_book->id());
@@ -428,7 +428,7 @@ public function testBookOutline() {
     $edit = [];
     $edit['book[bid]'] = $node->id();
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
-    $node = \Drupal::entityManager()->getStorage('node')->load($node->id());
+    $node = \Drupal::entityTypeManager()->getStorage('node')->load($node->id());
 
     // Test the book array.
     $this->assertEqual($node->book['nid'], $node->id());
@@ -519,7 +519,7 @@ public function testHookNodeLoadAccess() {
     $this->drupalLogin($this->bookAuthor);
     $this->book = $this->createBookNode('new');
     // Reset any internal static caching.
-    $node_storage = \Drupal::entityManager()->getStorage('node');
+    $node_storage = \Drupal::entityTypeManager()->getStorage('node');
     $node_storage->resetCache();
 
     // Log in as user without access to the book node, so no 'node test view'
diff --git a/core/modules/book/tests/src/Functional/BookTestTrait.php b/core/modules/book/tests/src/Functional/BookTestTrait.php
index edc6cbfe67e9..67520c4851fd 100644
--- a/core/modules/book/tests/src/Functional/BookTestTrait.php
+++ b/core/modules/book/tests/src/Functional/BookTestTrait.php
@@ -198,7 +198,7 @@ public function createBookNode($book_nid, $parent = NULL, $edit = []) {
       $edit['book[pid]'] = $parent;
       $this->drupalPostForm(NULL, $edit, t('Save'));
       // Make sure the parent was flagged as having children.
-      $parent_node = \Drupal::entityManager()->getStorage('node')->loadUnchanged($parent);
+      $parent_node = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($parent);
       $this->assertFalse(empty($parent_node->book['has_children']), 'Parent node is marked as having children');
     }
     else {
diff --git a/core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php b/core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php
index 9ee79c78dc61..30b8a8445a12 100644
--- a/core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php
+++ b/core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php
@@ -121,7 +121,7 @@ protected function createBookNode($book_nid, $parent = NULL) {
       $edit['book[pid]'] = $parent;
       $this->drupalPostForm(NULL, $edit, t('Save'));
       // Make sure the parent was flagged as having children.
-      $parent_node = \Drupal::entityManager()->getStorage('node')->loadUnchanged($parent);
+      $parent_node = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($parent);
       $this->assertFalse(empty($parent_node->book['has_children']), 'Parent node is marked as having children');
     }
     else {
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index 357327281535..051f335c809a 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -177,7 +177,7 @@ function comment_field_config_update(FieldConfigInterface $field) {
   if ($field->getType() == 'comment') {
     // Comment field settings also affects the rendering of *comment* entities,
     // not only the *commented* entities.
-    \Drupal::entityManager()->getViewBuilder('comment')->resetCache();
+    \Drupal::entityTypeManager()->getViewBuilder('comment')->resetCache();
   }
 }
 
@@ -357,7 +357,7 @@ function comment_form_field_ui_display_overview_form_alter(&$form, FormStateInte
  */
 function comment_entity_storage_load($entities, $entity_type) {
   // Comments can only be attached to content entities, so skip others.
-  if (!\Drupal::entityManager()->getDefinition($entity_type)->entityClassImplements(FieldableEntityInterface::class)) {
+  if (!\Drupal::entityTypeManager()->getDefinition($entity_type)->entityClassImplements(FieldableEntityInterface::class)) {
     return;
   }
   if (!\Drupal::service('comment.manager')->getFields($entity_type)) {
@@ -426,7 +426,7 @@ function comment_entity_predelete(EntityInterface $entity) {
  *   FALSE otherwise.
  */
 function _comment_entity_uses_integer_id($entity_type_id) {
-  $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id);
+  $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id);
   $entity_type_id_key = $entity_type->getKey('id');
   if ($entity_type_id_key === FALSE) {
     return FALSE;
@@ -453,7 +453,7 @@ function comment_node_update_index(EntityInterface $node) {
     // edit could change the security situation so it is not safe to index the
     // comments.
     $index_comments = TRUE;
-    $roles = \Drupal::entityManager()->getStorage('user_role')->loadMultiple();
+    $roles = \Drupal::entityTypeManager()->getStorage('user_role')->loadMultiple();
     $authenticated_can_access = $roles[RoleInterface::AUTHENTICATED_ID]->hasPermission('access comments');
     foreach ($roles as $rid => $role) {
       if ($role->hasPermission('search content') && !$role->hasPermission('access comments')) {
@@ -477,10 +477,10 @@ function comment_node_update_index(EntityInterface $node) {
       $mode = $field_definition->getSetting('default_mode');
       $comments_per_page = $field_definition->getSetting('per_page');
       if ($node->get($field_name)->status) {
-        $comments = \Drupal::entityManager()->getStorage('comment')
+        $comments = \Drupal::entityTypeManager()->getStorage('comment')
           ->loadThread($node, $field_name, $mode, $comments_per_page);
         if ($comments) {
-          $build[] = \Drupal::entityManager()->getViewBuilder('comment')->viewMultiple($comments);
+          $build[] = \Drupal::entityTypeManager()->getViewBuilder('comment')->viewMultiple($comments);
         }
       }
     }
diff --git a/core/modules/comment/comment.views.inc b/core/modules/comment/comment.views.inc
index 11abede944c1..e5df31a1a05b 100644
--- a/core/modules/comment/comment.views.inc
+++ b/core/modules/comment/comment.views.inc
@@ -23,7 +23,7 @@ function comment_views_data_alter(&$data) {
   ];
 
   // Provide a integration for each entity type except comment.
-  foreach (\Drupal::entityManager()->getDefinitions() as $entity_type_id => $entity_type) {
+  foreach (\Drupal::entityTypeManager()->getDefinitions() as $entity_type_id => $entity_type) {
     if ($entity_type_id == 'comment' || !$entity_type->entityClassImplements(ContentEntityInterface::class) || !$entity_type->getBaseTable()) {
       continue;
     }
diff --git a/core/modules/comment/src/CommentViewsData.php b/core/modules/comment/src/CommentViewsData.php
index 7fb74217c4c5..956a33544b0a 100644
--- a/core/modules/comment/src/CommentViewsData.php
+++ b/core/modules/comment/src/CommentViewsData.php
@@ -193,7 +193,7 @@ public function getViewsData() {
     unset($data['comment_field_data']['thread']['filter']);
     unset($data['comment_field_data']['thread']['argument']);
 
-    $entities_types = \Drupal::entityManager()->getDefinitions();
+    $entities_types = \Drupal::entityTypeManager()->getDefinitions();
 
     // Provide a relationship for each entity type except comment.
     foreach ($entities_types as $type => $entity_type) {
diff --git a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php
index 444033caf543..b1a3de16f41f 100644
--- a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php
+++ b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php
@@ -4,6 +4,8 @@
 
 use Drupal\Core\Database\Connection;
 use Drupal\comment\CommentInterface;
+use Drupal\Core\Entity\EntityFieldManagerInterface;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\node\Entity\Node;
 use Drupal\views\Plugin\views\field\NumericField;
@@ -35,6 +37,20 @@ public function usesGroupBy() {
    */
   protected $database;
 
+  /**
+   * The entity type manager.
+   *
+   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
+   */
+  protected $entityTypeManager;
+
+  /**
+   * The entity field manager.
+   *
+   * @var \Drupal\Core\Entity\EntityFieldManagerInterface
+   */
+  protected $entityFieldManager;
+
   /**
    * Constructs a \Drupal\comment\Plugin\views\field\NodeNewComments object.
    *
@@ -46,18 +62,38 @@ public function usesGroupBy() {
    *   The plugin implementation definition.
    * @param \Drupal\Core\Database\Connection $database
    *   Database Service Object.
+   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
+   *   The entity type manager service.
+   * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
+   *   The entity field manager service.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, Connection $database) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, Connection $database, EntityTypeManagerInterface $entity_type_manager = NULL, EntityFieldManagerInterface $entity_field_manager = NULL) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
-
     $this->database = $database;
+    if (!$entity_type_manager) {
+      @trigger_error("Not passing the entity type manager to the NodeNewComments constructor is deprecated in drupal:8.8.0 and will be required in drupal 9.0.0. @see https://www.drupal.org/node/3047897");
+      $entity_type_manager = \Drupal::entityTypeManager();
+    }
+    if (!$entity_field_manager) {
+      @trigger_error("Not passing the entity type manager to the NodeNewComments constructor is deprecated in drupal:8.8.0 and will be required in drupal 9.0.0. @see https://www.drupal.org/node/3047897");
+      $entity_field_manager = \Drupal::service('entity_field.manager');
+    }
+    $this->entityTypeManager = $entity_type_manager;
+    $this->entityFieldManager = $entity_field_manager;
   }
 
   /**
    * {@inheritdoc}
    */
   public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
-    return new static($configuration, $plugin_id, $plugin_definition, $container->get('database'));
+    return new static(
+      $configuration,
+      $plugin_id,
+      $plugin_definition,
+      $container->get('database'),
+      $container->get('entity_type.manager'),
+      $container->get('entity_field.manager')
+    );
   }
 
   /**
@@ -166,8 +202,7 @@ protected function renderLink($data, ResultRow $values) {
       // reference, we arbitrarily use the first such field name we find.
       // @todo Provide a means for selecting the comment field.
       //   https://www.drupal.org/node/2594201
-      $entity_type_manager = \Drupal::entityTypeManager();
-      $field_map = \Drupal::service('entity_field.manager')->getFieldMapByFieldType('comment');
+      $field_map = $this->entityFieldManager->getFieldMapByFieldType('comment');
       $comment_field_name = 'comment';
       foreach ($field_map['node'] as $field_name => $field_data) {
         foreach ($field_data['bundles'] as $bundle_name) {
@@ -177,7 +212,7 @@ protected function renderLink($data, ResultRow $values) {
           }
         }
       }
-      $page_number = $entity_type_manager->getStorage('comment')
+      $page_number = $this->entityTypeManager->getStorage('comment')
         ->getNewCommentPageNumber($this->getValue($values, 'comment_count'), $this->getValue($values), $node, $comment_field_name);
       $this->options['alter']['make_link'] = TRUE;
       $this->options['alter']['url'] = $node->toUrl();
diff --git a/core/modules/comment/src/Tests/CommentTestBase.php b/core/modules/comment/src/Tests/CommentTestBase.php
index b3c3d990b156..4c239816047d 100644
--- a/core/modules/comment/src/Tests/CommentTestBase.php
+++ b/core/modules/comment/src/Tests/CommentTestBase.php
@@ -176,7 +176,7 @@ public function postComment($entity, $comment, $subject = '', $contact = NULL, $
     }
 
     if (isset($match[1])) {
-      \Drupal::entityManager()->getStorage('comment')->resetCache([$match[1]]);
+      \Drupal::entityTypeManager()->getStorage('comment')->resetCache([$match[1]]);
       return Comment::load($match[1]);
     }
   }
diff --git a/core/modules/comment/tests/src/Functional/CommentPagerTest.php b/core/modules/comment/tests/src/Functional/CommentPagerTest.php
index ff5f17cf455d..3c4d46b1c11c 100644
--- a/core/modules/comment/tests/src/Functional/CommentPagerTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentPagerTest.php
@@ -283,7 +283,7 @@ public function testCommentNewPageIndicator() {
 
     $node = Node::load($node->id());
     foreach ($expected_pages as $new_replies => $expected_page) {
-      $returned_page = \Drupal::entityManager()->getStorage('comment')
+      $returned_page = \Drupal::entityTypeManager()->getStorage('comment')
         ->getNewCommentPageNumber($node->get('comment')->comment_count, $new_replies, $node, 'comment');
       $this->assertIdentical($expected_page, $returned_page, format_string('Flat mode, @new replies: expected page @expected, returned page @returned.', ['@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page]));
     }
@@ -305,10 +305,10 @@ public function testCommentNewPageIndicator() {
       6 => 0,
     ];
 
-    \Drupal::entityManager()->getStorage('node')->resetCache([$node->id()]);
+    \Drupal::entityTypeManager()->getStorage('node')->resetCache([$node->id()]);
     $node = Node::load($node->id());
     foreach ($expected_pages as $new_replies => $expected_page) {
-      $returned_page = \Drupal::entityManager()->getStorage('comment')
+      $returned_page = \Drupal::entityTypeManager()->getStorage('comment')
         ->getNewCommentPageNumber($node->get('comment')->comment_count, $new_replies, $node, 'comment');
       $this->assertEqual($expected_page, $returned_page, format_string('Threaded mode, @new replies: expected page @expected, returned page @returned.', ['@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page]));
     }
diff --git a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
index cee08ae39c91..c64eeaa6db40 100644
--- a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
@@ -185,7 +185,7 @@ public function testCommentEditPreviewSave() {
     $this->drupalPostForm('comment/' . $comment->id() . '/edit', $displayed, t('Save'));
 
     // Check that the saved comment is still correct.
-    $comment_storage = \Drupal::entityManager()->getStorage('comment');
+    $comment_storage = \Drupal::entityTypeManager()->getStorage('comment');
     $comment_storage->resetCache([$comment->id()]);
     /** @var \Drupal\comment\CommentInterface $comment_loaded */
     $comment_loaded = Comment::load($comment->id());
diff --git a/core/modules/comment/tests/src/Functional/CommentTestBase.php b/core/modules/comment/tests/src/Functional/CommentTestBase.php
index 9574681872e0..e9907b3bea13 100644
--- a/core/modules/comment/tests/src/Functional/CommentTestBase.php
+++ b/core/modules/comment/tests/src/Functional/CommentTestBase.php
@@ -171,7 +171,7 @@ public function postComment($entity, $comment, $subject = '', $contact = NULL, $
     }
 
     if (isset($match[1])) {
-      \Drupal::entityManager()->getStorage('comment')->resetCache([$match[1]]);
+      \Drupal::entityTypeManager()->getStorage('comment')->resetCache([$match[1]]);
       return Comment::load($match[1]);
     }
   }
diff --git a/core/modules/comment/tests/src/Functional/CommentTranslationUITest.php b/core/modules/comment/tests/src/Functional/CommentTranslationUITest.php
index 68a60a479045..2d7787e7446b 100644
--- a/core/modules/comment/tests/src/Functional/CommentTranslationUITest.php
+++ b/core/modules/comment/tests/src/Functional/CommentTranslationUITest.php
@@ -125,8 +125,8 @@ protected function getNewEntityValues($langcode) {
    * {@inheritdoc}
    */
   protected function doTestPublishedStatus() {
-    $entity_manager = \Drupal::entityManager();
-    $storage = $entity_manager->getStorage($this->entityTypeId);
+    $entity_type_manager = \Drupal::entityTypeManager();
+    $storage = $entity_type_manager->getStorage($this->entityTypeId);
 
     $storage->resetCache();
     $entity = $storage->load($this->entityId);
diff --git a/core/modules/comment/tests/src/Functional/CommentTypeTest.php b/core/modules/comment/tests/src/Functional/CommentTypeTest.php
index 04173c43cb91..c2eeb928cf84 100644
--- a/core/modules/comment/tests/src/Functional/CommentTypeTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentTypeTest.php
@@ -84,7 +84,7 @@ public function testCommentTypeCreation() {
     // Save the form and ensure the entity-type value is preserved even though
     // the field isn't present.
     $this->drupalPostForm(NULL, [], t('Save'));
-    \Drupal::entityManager()->getStorage('comment_type')->resetCache(['foo']);
+    \Drupal::entityTypeManager()->getStorage('comment_type')->resetCache(['foo']);
     $comment_type = CommentType::load('foo');
     $this->assertEqual($comment_type->getTargetEntityTypeId(), 'node');
   }
diff --git a/core/modules/comment/tests/src/Kernel/CommentDefaultFormatterCacheTagsTest.php b/core/modules/comment/tests/src/Kernel/CommentDefaultFormatterCacheTagsTest.php
index bdea71df15fa..e681a4d9ad62 100644
--- a/core/modules/comment/tests/src/Kernel/CommentDefaultFormatterCacheTagsTest.php
+++ b/core/modules/comment/tests/src/Kernel/CommentDefaultFormatterCacheTagsTest.php
@@ -74,7 +74,7 @@ public function testCacheTags() {
     $commented_entity->save();
 
     // Verify cache tags on the rendered entity before it has comments.
-    $build = \Drupal::entityManager()
+    $build = \Drupal::entityTypeManager()
       ->getViewBuilder('entity_test')
       ->view($commented_entity);
     $renderer->renderRoot($build);
@@ -117,7 +117,7 @@ public function testCacheTags() {
     $commented_entity = $storage->load($commented_entity->id());
 
     // Verify cache tags on the rendered entity when it has comments.
-    $build = \Drupal::entityManager()
+    $build = \Drupal::entityTypeManager()
       ->getViewBuilder('entity_test')
       ->view($commented_entity);
     $renderer->renderRoot($build);
@@ -142,7 +142,7 @@ public function testCacheTags() {
     // builder elements bubble up outside of the entity and we can check that
     // it got the correct cache max age.
     $build = ['#type' => 'container'];
-    $build['entity'] = \Drupal::entityManager()
+    $build['entity'] = \Drupal::entityTypeManager()
       ->getViewBuilder('entity_test')
       ->view($commented_entity);
     $renderer->renderRoot($build);
diff --git a/core/modules/comment/tests/src/Kernel/CommentValidationTest.php b/core/modules/comment/tests/src/Kernel/CommentValidationTest.php
index 67bbda8fb612..411ad5460849 100644
--- a/core/modules/comment/tests/src/Kernel/CommentValidationTest.php
+++ b/core/modules/comment/tests/src/Kernel/CommentValidationTest.php
@@ -138,7 +138,7 @@ public function testValidation() {
     $field->setSetting('anonymous', CommentInterface::ANONYMOUS_MUST_CONTACT);
     $field->save();
     // Reset the node entity.
-    \Drupal::entityManager()->getStorage('node')->resetCache([$node->id()]);
+    \Drupal::entityTypeManager()->getStorage('node')->resetCache([$node->id()]);
     $node = Node::load($node->id());
     // Create a new comment with the new field.
     $comment = $this->entityTypeManager->getStorage('comment')->create([
diff --git a/core/modules/comment/tests/src/Kernel/Migrate/MigrateCommentStubTest.php b/core/modules/comment/tests/src/Kernel/Migrate/MigrateCommentStubTest.php
index 3b0674222cd1..fdb415e46ee7 100644
--- a/core/modules/comment/tests/src/Kernel/Migrate/MigrateCommentStubTest.php
+++ b/core/modules/comment/tests/src/Kernel/Migrate/MigrateCommentStubTest.php
@@ -31,7 +31,7 @@ protected function setUp() {
     $this->installSchema('system', ['sequences']);
 
     // Make sure uid 0 is created (default uid for comments is 0).
-    $storage = \Drupal::entityManager()->getStorage('user');
+    $storage = \Drupal::entityTypeManager()->getStorage('user');
     // Insert a row for the anonymous user.
     $storage
       ->create([
diff --git a/core/modules/comment/tests/src/Kernel/Views/CommentUserNameTest.php b/core/modules/comment/tests/src/Kernel/Views/CommentUserNameTest.php
index 30a8a64ffa21..1a8db39d4b3c 100644
--- a/core/modules/comment/tests/src/Kernel/Views/CommentUserNameTest.php
+++ b/core/modules/comment/tests/src/Kernel/Views/CommentUserNameTest.php
@@ -42,7 +42,7 @@ protected function setUp($import_test_views = TRUE) {
     $this->installConfig(['user']);
 
     // Create an anonymous user.
-    $storage = \Drupal::entityManager()->getStorage('user');
+    $storage = \Drupal::entityTypeManager()->getStorage('user');
     // Insert a row for the anonymous user.
     $storage
       ->create([
diff --git a/core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php b/core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php
index 7c5fa1fac19f..cf9ff99f221e 100644
--- a/core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php
+++ b/core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php
@@ -25,7 +25,7 @@ class ConfigEntityListMultilingualTest extends BrowserTestBase {
   protected function setUp() {
     parent::setUp();
     // Delete the override config_test entity. It is not required by this test.
-    \Drupal::entityManager()->getStorage('config_test')->load('override')->delete();
+    \Drupal::entityTypeManager()->getStorage('config_test')->load('override')->delete();
     ConfigurableLanguage::createFromLangcode('hu')->save();
 
     $this->drupalPlaceBlock('local_actions_block');
diff --git a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php
index b92629d1977d..16fcc89dd642 100644
--- a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php
+++ b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php
@@ -30,7 +30,7 @@ protected function setUp() {
     parent::setUp();
     // Delete the override config_test entity since it is not required by this
     // test.
-    \Drupal::entityManager()->getStorage('config_test')->load('override')->delete();
+    \Drupal::entityTypeManager()->getStorage('config_test')->load('override')->delete();
     $this->drupalPlaceBlock('local_actions_block');
   }
 
@@ -38,7 +38,7 @@ protected function setUp() {
    * Tests entity list builder methods.
    */
   public function testList() {
-    $controller = \Drupal::entityManager()->getListBuilder('config_test');
+    $controller = \Drupal::entityTypeManager()->getListBuilder('config_test');
 
     // Test getStorage() method.
     $this->assertTrue($controller->getStorage() instanceof EntityStorageInterface, 'EntityStorage instance in storage.');
@@ -252,7 +252,7 @@ public function testListUI() {
   public function testPager() {
     $this->drupalLogin($this->drupalCreateUser(['administer site configuration']));
 
-    $storage = \Drupal::entityManager()->getListBuilder('config_test')->getStorage();
+    $storage = \Drupal::service('entity_type.manager')->getListBuilder('config_test')->getStorage();
 
     // Create 51 test entities.
     for ($i = 1; $i < 52; $i++) {
diff --git a/core/modules/config/tests/src/Functional/ConfigInstallProfileOverrideTest.php b/core/modules/config/tests/src/Functional/ConfigInstallProfileOverrideTest.php
index 8615da5865b8..167d2a7e26e8 100644
--- a/core/modules/config/tests/src/Functional/ConfigInstallProfileOverrideTest.php
+++ b/core/modules/config/tests/src/Functional/ConfigInstallProfileOverrideTest.php
@@ -94,7 +94,7 @@ public function testInstallProfileConfigOverwrite() {
     // configuration in a modules config/install directory.
     $this->container->get('module_installer')->install(['config_test']);
     $this->rebuildContainer();
-    $config_test_storage = \Drupal::entityManager()->getStorage('config_test');
+    $config_test_storage = \Drupal::entityTypeManager()->getStorage('config_test');
     $this->assertEqual($config_test_storage->load('dotted.default')->label(), 'Default install profile override', 'The config_test entity is overridden by the profile optional configuration.');
     // Test that override of optional configuration does work.
     $this->assertEqual($config_test_storage->load('override')->label(), 'Override', 'The optional config_test entity is overridden by the profile optional configuration.');
@@ -115,7 +115,7 @@ public function testInstallProfileConfigOverwrite() {
     // that deleted profile configuration is not re-created.
     $this->container->get('module_installer')->install(['config_other_module_config_test']);
     $this->rebuildContainer();
-    $config_test_storage = \Drupal::entityManager()->getStorage('config_test');
+    $config_test_storage = \Drupal::entityTypeManager()->getStorage('config_test');
     $this->assertNull($config_test_storage->load('completely_new'));
   }
 
diff --git a/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php b/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php
index 69a7ed74ea2e..65e76e05835f 100644
--- a/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php
+++ b/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php
@@ -36,7 +36,7 @@ protected function setUp() {
    * Tests importing a single configuration file.
    */
   public function testImport() {
-    $storage = \Drupal::entityManager()->getStorage('config_test');
+    $storage = \Drupal::entityTypeManager()->getStorage('config_test');
     $uuid = \Drupal::service('uuid');
 
     $this->drupalLogin($this->drupalCreateUser(['import configuration']));
@@ -254,7 +254,7 @@ public function testExport() {
     $this->drupalGet('admin/config/development/configuration/single/export/date_format/fallback');
     $this->assertFieldByXPath('//select[@name="config_name"]//option[@selected="selected"]', t('Fallback date format (fallback)'), 'The fallback date format config entity is selected when specified in the URL.');
 
-    $fallback_date = \Drupal::entityManager()->getStorage('date_format')->load('fallback');
+    $fallback_date = \Drupal::entityTypeManager()->getStorage('date_format')->load('fallback');
     $yaml_text = $this->xpath('//textarea[@name="export"]')[0]->getValue();
     $this->assertEqual(Yaml::decode($yaml_text), $fallback_date->toArray(), 'The fallback date format config entity export code is displayed.');
   }
diff --git a/core/modules/config_translation/config_translation.api.php b/core/modules/config_translation/config_translation.api.php
index f97e25997ad9..8e337309c02c 100644
--- a/core/modules/config_translation/config_translation.api.php
+++ b/core/modules/config_translation/config_translation.api.php
@@ -32,14 +32,14 @@
  * @see \Drupal\config_translation\Routing\RouteSubscriber::routes()
  */
 function hook_config_translation_info(&$info) {
-  $entity_manager = \Drupal::entityManager();
+  $entity_type_manager = \Drupal::entityTypeManager();
   $route_provider = \Drupal::service('router.route_provider');
 
   // If field UI is not enabled, the base routes of the type
   // "entity.field_config.{$entity_type}_field_edit_form" are not defined.
   if (\Drupal::moduleHandler()->moduleExists('field_ui')) {
     // Add fields entity mappers to all fieldable entity types defined.
-    foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) {
+    foreach ($entity_type_manager->getDefinitions() as $entity_type_id => $entity_type) {
       $base_route = NULL;
       try {
         $base_route = $route_provider->getRouteByName('entity.field_config.' . $entity_type_id . '_field_edit_form');
diff --git a/core/modules/config_translation/config_translation.module b/core/modules/config_translation/config_translation.module
index e6818386e0a3..5ca9313f717c 100644
--- a/core/modules/config_translation/config_translation.module
+++ b/core/modules/config_translation/config_translation.module
@@ -102,13 +102,13 @@ function config_translation_entity_type_alter(array &$entity_types) {
  * Implements hook_config_translation_info().
  */
 function config_translation_config_translation_info(&$info) {
-  $entity_manager = \Drupal::entityManager();
+  $entity_type_manager = \Drupal::entityTypeManager();
 
   // If field UI is not enabled, the base routes of the type
   // "entity.field_config.{$entity_type}_field_edit_form" are not defined.
   if (\Drupal::moduleHandler()->moduleExists('field_ui')) {
     // Add fields entity mappers to all fieldable entity types defined.
-    foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) {
+    foreach ($entity_type_manager->getDefinitions() as $entity_type_id => $entity_type) {
       // Make sure entity type has field UI enabled and has a base route.
       if ($entity_type->get('field_ui_base_route')) {
         $info[$entity_type_id . '_fields'] = [
@@ -123,7 +123,7 @@ function config_translation_config_translation_info(&$info) {
   }
 
   // Discover configuration entities automatically.
-  foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) {
+  foreach ($entity_type_manager->getDefinitions() as $entity_type_id => $entity_type) {
     // Determine base path for entities automatically if provided via the
     // configuration entity.
     if (
diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php
index 9ccbb135d2f2..e4aae1a6bced 100644
--- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php
+++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php
@@ -107,7 +107,7 @@ public function testMapperListPage() {
         $this->assertIdentical('Translate', $dropbutton->getText());
       }
 
-      $entity_type = \Drupal::entityManager()->getDefinition($test_entity->getEntityTypeId());
+      $entity_type = \Drupal::entityTypeManager()->getDefinition($test_entity->getEntityTypeId());
       $this->drupalGet($base_url . '/translate');
 
       $title = $test_entity->label() . ' ' . $entity_type->getLowercaseLabel();
diff --git a/core/modules/contact/tests/src/Kernel/MessageEntityTest.php b/core/modules/contact/tests/src/Kernel/MessageEntityTest.php
index e7343b9166c6..f3025e7b1ced 100644
--- a/core/modules/contact/tests/src/Kernel/MessageEntityTest.php
+++ b/core/modules/contact/tests/src/Kernel/MessageEntityTest.php
@@ -62,8 +62,8 @@ public function testMessageMethods() {
     $access_user = $this->createUser(['uid' => 3], ['access site-wide contact form']);
     $admin = $this->createUser(['uid' => 4], ['administer contact forms']);
 
-    $this->assertFalse(\Drupal::entityManager()->getAccessControlHandler('contact_message')->createAccess(NULL, $no_access_user));
-    $this->assertTrue(\Drupal::entityManager()->getAccessControlHandler('contact_message')->createAccess(NULL, $access_user));
+    $this->assertFalse(\Drupal::entityTypeManager()->getAccessControlHandler('contact_message')->createAccess(NULL, $no_access_user));
+    $this->assertTrue(\Drupal::entityTypeManager()->getAccessControlHandler('contact_message')->createAccess(NULL, $access_user));
     $this->assertTrue($message->access('edit', $admin));
     $this->assertFalse($message->access('edit', $access_user));
   }
diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module
index 8ebe702ed41f..10f546dfd52e 100644
--- a/core/modules/content_translation/content_translation.module
+++ b/core/modules/content_translation/content_translation.module
@@ -334,7 +334,7 @@ function content_translation_entity_operation(EntityInterface $entity) {
 function content_translation_views_data_alter(array &$data) {
   // Add the content translation entity link definition to Views data for entity
   // types having translation enabled.
-  $entity_types = \Drupal::entityManager()->getDefinitions();
+  $entity_types = \Drupal::entityTypeManager()->getDefinitions();
   /** @var \Drupal\content_translation\ContentTranslationManagerInterface $manager */
   $manager = \Drupal::service('content_translation.manager');
   foreach ($entity_types as $entity_type_id => $entity_type) {
@@ -393,7 +393,7 @@ function content_translation_form_alter(array &$form, FormStateInterface $form_s
   // be the 'add' or 'edit' form. It also tries a 'default' form in case neither
   // of the aforementioned forms are defined.
   if ($entity instanceof ContentEntityInterface && $entity->isTranslatable() && count($entity->getTranslationLanguages()) > 1 && in_array($op, ['edit', 'add', 'default'], TRUE)) {
-    $controller = \Drupal::entityManager()->getHandler($entity->getEntityTypeId(), 'translation');
+    $controller = \Drupal::entityTypeManager()->getHandler($entity->getEntityTypeId(), 'translation');
     $controller->entityFormAlter($form, $form_state, $entity);
 
     // @todo Move the following lines to the code generating the property form
@@ -454,7 +454,7 @@ function content_translation_language_fallback_candidates_entity_view_alter(&$ca
 function content_translation_entity_extra_field_info() {
   $extra = [];
   $bundle_info_service = \Drupal::service('entity_type.bundle.info');
-  foreach (\Drupal::entityManager()->getDefinitions() as $entity_type => $info) {
+  foreach (\Drupal::entityTypeManager()->getDefinitions() as $entity_type => $info) {
     foreach ($bundle_info_service->getBundleInfo($entity_type) as $bundle => $bundle_info) {
       if (\Drupal::service('content_translation.manager')->isEnabled($entity_type, $bundle)) {
         $extra[$entity_type][$bundle]['form']['translation'] = [
diff --git a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php
index 2f4158bec2ad..d7f18c4c766b 100644
--- a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php
+++ b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php
@@ -127,7 +127,7 @@ protected function getTranslatorPermissions() {
    * Returns the translate permissions for the current entity and bundle.
    */
   protected function getTranslatePermission() {
-    $entity_type = \Drupal::entityManager()->getDefinition($this->entityTypeId);
+    $entity_type = \Drupal::entityTypeManager()->getDefinition($this->entityTypeId);
     if ($permission_granularity = $entity_type->getPermissionGranularity()) {
       return $permission_granularity == 'bundle' ? "translate {$this->bundle} {$this->entityTypeId}" : "translate {$this->entityTypeId}";
     }
@@ -175,7 +175,7 @@ protected function enableTranslation() {
     // picked up.
     \Drupal::service('content_translation.manager')->setEnabled($this->entityTypeId, $this->bundle, TRUE);
 
-    \Drupal::entityManager()->clearCachedDefinitions();
+    \Drupal::entityTypeManager()->clearCachedDefinitions();
     \Drupal::service('router.builder')->rebuild();
   }
 
@@ -224,7 +224,7 @@ protected function setupTestFields() {
   protected function createEntity($values, $langcode, $bundle_name = NULL) {
     $entity_values = $values;
     $entity_values['langcode'] = $langcode;
-    $entity_type = \Drupal::entityManager()->getDefinition($this->entityTypeId);
+    $entity_type = \Drupal::entityTypeManager()->getDefinition($this->entityTypeId);
     if ($bundle_key = $entity_type->getKey('bundle')) {
       $entity_values[$bundle_key] = $bundle_name ?: $this->bundle;
     }
diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationOperationsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationOperationsTest.php
index fc0f788a6a94..8486ac529ff0 100644
--- a/core/modules/content_translation/tests/src/Functional/ContentTranslationOperationsTest.php
+++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationOperationsTest.php
@@ -126,7 +126,7 @@ public function testOperationTranslateLink() {
    * @see content_translation_translate_access()
    */
   public function testContentTranslationOverviewAccess() {
-    $access_control_handler = \Drupal::entityManager()->getAccessControlHandler('node');
+    $access_control_handler = \Drupal::entityTypeManager()->getAccessControlHandler('node');
     $user = $this->createUser(['create content translations', 'access content']);
     $this->drupalLogin($user);
 
diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php
index 5c9fc23ee6e2..7451e17dbad0 100644
--- a/core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php
+++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php
@@ -121,7 +121,7 @@ protected function getTranslatorPermissions() {
    * Returns the translate permissions for the current entity and bundle.
    */
   protected function getTranslatePermission() {
-    $entity_type = \Drupal::entityManager()->getDefinition($this->entityTypeId);
+    $entity_type = \Drupal::entityTypeManager()->getDefinition($this->entityTypeId);
     if ($permission_granularity = $entity_type->getPermissionGranularity()) {
       return $permission_granularity == 'bundle' ? "translate {$this->bundle} {$this->entityTypeId}" : "translate {$this->entityTypeId}";
     }
@@ -218,7 +218,7 @@ protected function setupTestFields() {
   protected function createEntity($values, $langcode, $bundle_name = NULL) {
     $entity_values = $values;
     $entity_values['langcode'] = $langcode;
-    $entity_type = \Drupal::entityManager()->getDefinition($this->entityTypeId);
+    $entity_type = \Drupal::entityTypeManager()->getDefinition($this->entityTypeId);
     if ($bundle_key = $entity_type->getKey('bundle')) {
       $entity_values[$bundle_key] = $bundle_name ?: $this->bundle;
     }
diff --git a/core/modules/editor/editor.module b/core/modules/editor/editor.module
index 43cb782f3542..619d01f9b798 100644
--- a/core/modules/editor/editor.module
+++ b/core/modules/editor/editor.module
@@ -624,7 +624,7 @@ function editor_filter_format_presave(FilterFormatInterface $format) {
   }
 
   /** @var \Drupal\filter\FilterFormatInterface $original */
-  $original = \Drupal::entityManager()
+  $original = \Drupal::entityTypeManager()
     ->getStorage('filter_format')
     ->loadUnchanged($format->getOriginalId());
 
diff --git a/core/modules/editor/src/Entity/Editor.php b/core/modules/editor/src/Entity/Editor.php
index 07c9d24aa871..5d60313a4271 100644
--- a/core/modules/editor/src/Entity/Editor.php
+++ b/core/modules/editor/src/Entity/Editor.php
@@ -127,7 +127,7 @@ public function hasAssociatedFilterFormat() {
    */
   public function getFilterFormat() {
     if (!$this->filterFormat) {
-      $this->filterFormat = \Drupal::entityManager()->getStorage('filter_format')->load($this->format);
+      $this->filterFormat = \Drupal::entityTypeManager()->getStorage('filter_format')->load($this->format);
     }
     return $this->filterFormat;
   }
diff --git a/core/modules/editor/tests/src/Kernel/EditorImageDialogTest.php b/core/modules/editor/tests/src/Kernel/EditorImageDialogTest.php
index 6500d1adefd0..0d0ecaaa605e 100644
--- a/core/modules/editor/tests/src/Kernel/EditorImageDialogTest.php
+++ b/core/modules/editor/tests/src/Kernel/EditorImageDialogTest.php
@@ -108,7 +108,7 @@ public function testEditorImageDialog() {
       ->addBuildInfo('args', [$this->editor]);
 
     $form_builder = $this->container->get('form_builder');
-    $form_object = new EditorImageDialog(\Drupal::entityManager()->getStorage('file'));
+    $form_object = new EditorImageDialog(\Drupal::entityTypeManager()->getStorage('file'));
     $form_id = $form_builder->getFormId($form_object, $form_state);
     $form = $form_builder->retrieveForm($form_id, $form_state);
     $form_builder->prepareForm($form_id, $form, $form_state);
diff --git a/core/modules/field/field.module b/core/modules/field/field.module
index 37b6517a52cc..987727a9b8d0 100644
--- a/core/modules/field/field.module
+++ b/core/modules/field/field.module
@@ -171,7 +171,7 @@ function field_cron() {
  * Implements hook_entity_field_storage_info().
  */
 function field_entity_field_storage_info(EntityTypeInterface $entity_type) {
-  if (\Drupal::entityManager()->getStorage($entity_type->id()) instanceof DynamicallyFieldableEntityStorageInterface) {
+  if (\Drupal::entityTypeManager()->getStorage($entity_type->id()) instanceof DynamicallyFieldableEntityStorageInterface) {
     // Query by filtering on the ID as this is more efficient than filtering
     // on the entity_type property directly.
     $ids = \Drupal::entityQuery('field_storage_config')
@@ -192,7 +192,7 @@ function field_entity_field_storage_info(EntityTypeInterface $entity_type) {
  * Implements hook_entity_bundle_field_info().
  */
 function field_entity_bundle_field_info(EntityTypeInterface $entity_type, $bundle, array $base_field_definitions) {
-  if (\Drupal::entityManager()->getStorage($entity_type->id()) instanceof DynamicallyFieldableEntityStorageInterface) {
+  if (\Drupal::entityTypeManager()->getStorage($entity_type->id()) instanceof DynamicallyFieldableEntityStorageInterface) {
     // Query by filtering on the ID as this is more efficient than filtering
     // on the entity_type property directly.
     $ids = \Drupal::entityQuery('field_config')
@@ -213,7 +213,7 @@ function field_entity_bundle_field_info(EntityTypeInterface $entity_type, $bundl
  * Implements hook_entity_bundle_delete().
  */
 function field_entity_bundle_delete($entity_type_id, $bundle) {
-  $storage = \Drupal::entityManager()->getStorage('field_config');
+  $storage = \Drupal::entityTypeManager()->getStorage('field_config');
   // Get the fields on the bundle.
   $fields = $storage->loadByProperties(['entity_type' => $entity_type_id, 'bundle' => $bundle]);
   // This deletes the data for the field as well as the field themselves. This
@@ -271,7 +271,7 @@ function field_entity_bundle_delete($entity_type_id, $bundle) {
  */
 function _field_create_entity_from_ids($ids) {
   $id_properties = [];
-  $entity_type = \Drupal::entityManager()->getDefinition($ids->entity_type);
+  $entity_type = \Drupal::entityTypeManager()->getDefinition($ids->entity_type);
   if ($id_key = $entity_type->getKey('id')) {
     $id_properties[$id_key] = $ids->entity_id;
   }
diff --git a/core/modules/field/field.purge.inc b/core/modules/field/field.purge.inc
index a2b2b929758c..11b2ac11a635 100644
--- a/core/modules/field/field.purge.inc
+++ b/core/modules/field/field.purge.inc
@@ -77,7 +77,7 @@ function field_purge_batch($batch_size, $field_storage_unique_id = NULL) {
 
   $fields = $deleted_fields_repository->getFieldDefinitions($field_storage_unique_id);
 
-  $info = \Drupal::entityManager()->getDefinitions();
+  $info = \Drupal::entityTypeManager()->getDefinitions();
   foreach ($fields as $field) {
     $entity_type = $field->getTargetEntityTypeId();
 
@@ -89,7 +89,7 @@ function field_purge_batch($batch_size, $field_storage_unique_id = NULL) {
       continue;
     }
 
-    $count_purged = \Drupal::entityManager()->getStorage($entity_type)->purgeFieldData($field, $batch_size);
+    $count_purged = \Drupal::entityTypeManager()->getStorage($entity_type)->purgeFieldData($field, $batch_size);
     if ($count_purged < $batch_size || $count_purged == 0) {
       // No field data remains for the field, so we can remove it.
       field_purge_field($field);
@@ -163,7 +163,7 @@ function field_purge_field_storage(FieldStorageDefinitionInterface $field_storag
   $deleted_fields_repository->removeFieldStorageDefinition($field_storage);
 
   // Notify the storage layer.
-  \Drupal::entityManager()->getStorage($field_storage->getTargetEntityTypeId())->finalizePurge($field_storage);
+  \Drupal::entityTypeManager()->getStorage($field_storage->getTargetEntityTypeId())->finalizePurge($field_storage);
 
   // Invoke external hooks after the cache is cleared for API consistency.
   \Drupal::moduleHandler()->invokeAll('field_purge_field_storage', [$field_storage]);
diff --git a/core/modules/field/src/ConfigImporterFieldPurger.php b/core/modules/field/src/ConfigImporterFieldPurger.php
index c38fc4b13631..22bf7c2058a9 100644
--- a/core/modules/field/src/ConfigImporterFieldPurger.php
+++ b/core/modules/field/src/ConfigImporterFieldPurger.php
@@ -71,7 +71,7 @@ protected static function initializeSandbox(array &$context, ConfigImporter $con
     $context['sandbox']['field']['steps_to_delete'] = 0;
     $fields = static::getFieldStoragesToPurge($context['sandbox']['field']['extensions'], $config_importer->getUnprocessedConfiguration('delete'));
     foreach ($fields as $field) {
-      $row_count = \Drupal::entityManager()->getStorage($field->getTargetEntityTypeId())
+      $row_count = \Drupal::entityTypeManager()->getStorage($field->getTargetEntityTypeId())
         ->countFieldData($field);
       if ($row_count > 0) {
         // The number of steps to delete each field is determined by the
@@ -117,7 +117,7 @@ public static function getFieldStoragesToPurge(array $extensions, array $deletes
     // where the module that provides the field type is also being uninstalled.
     $field_storage_ids = [];
     foreach ($deletes as $config_name) {
-      $field_storage_config_prefix = \Drupal::entityManager()->getDefinition('field_storage_config')->getConfigPrefix();
+      $field_storage_config_prefix = \Drupal::entityTypeManager()->getDefinition('field_storage_config')->getConfigPrefix();
       if (strpos($config_name, $field_storage_config_prefix . '.') === 0) {
         $field_storage_ids[] = ConfigEntityStorage::getIDFromConfigName($config_name, $field_storage_config_prefix);
       }
diff --git a/core/modules/field/src/Entity/FieldConfig.php b/core/modules/field/src/Entity/FieldConfig.php
index 411943b11c2d..2e06d2a47276 100644
--- a/core/modules/field/src/Entity/FieldConfig.php
+++ b/core/modules/field/src/Entity/FieldConfig.php
@@ -147,7 +147,6 @@ public function postCreate(EntityStorageInterface $storage) {
    *   In case of failures at the configuration storage level.
    */
   public function preSave(EntityStorageInterface $storage) {
-    $entity_manager = \Drupal::entityManager();
     $field_type_manager = \Drupal::service('plugin.manager.field.field_type');
 
     $storage_definition = $this->getFieldStorageDefinition();
@@ -248,7 +247,7 @@ public static function postDelete(EntityStorageInterface $storage, array $fields
       }
     }
     if ($storages_to_delete) {
-      \Drupal::entityManager()->getStorage('field_storage_config')->delete($storages_to_delete);
+      \Drupal::entityTypeManager()->getStorage('field_storage_config')->delete($storages_to_delete);
     }
   }
 
@@ -274,7 +273,7 @@ protected function linkTemplates() {
    */
   protected function urlRouteParameters($rel) {
     $parameters = parent::urlRouteParameters($rel);
-    $entity_type = \Drupal::entityManager()->getDefinition($this->entity_type);
+    $entity_type = \Drupal::entityTypeManager()->getDefinition($this->entity_type);
     $bundle_parameter_key = $entity_type->getBundleEntityType() ?: 'bundle';
     $parameters[$bundle_parameter_key] = $this->bundle;
     return $parameters;
@@ -372,7 +371,7 @@ public function getUniqueIdentifier() {
    *   name, otherwise NULL.
    */
   public static function loadByName($entity_type_id, $bundle, $field_name) {
-    return \Drupal::entityManager()->getStorage('field_config')->load($entity_type_id . '.' . $bundle . '.' . $field_name);
+    return \Drupal::entityTypeManager()->getStorage('field_config')->load($entity_type_id . '.' . $bundle . '.' . $field_name);
   }
 
 }
diff --git a/core/modules/field/src/Entity/FieldStorageConfig.php b/core/modules/field/src/Entity/FieldStorageConfig.php
index 3277c5416977..2c02eebf442d 100644
--- a/core/modules/field/src/Entity/FieldStorageConfig.php
+++ b/core/modules/field/src/Entity/FieldStorageConfig.php
@@ -351,7 +351,7 @@ public function calculateDependencies() {
     $this->addDependencies($definition['class']::calculateStorageDependencies($this));
 
     // Ensure the field is dependent on the provider of the entity type.
-    $entity_type = \Drupal::entityManager()->getDefinition($this->entity_type);
+    $entity_type = \Drupal::entityTypeManager()->getDefinition($this->entity_type);
     $this->addDependency('module', $entity_type->getProvider());
     return $this;
   }
@@ -389,10 +389,10 @@ protected function preSaveUpdated(EntityStorageInterface $storage) {
   public function postSave(EntityStorageInterface $storage, $update = TRUE) {
     if ($update) {
       // Invalidate the render cache for all affected entities.
-      $entity_manager = \Drupal::entityManager();
+      $entity_type_manager = \Drupal::entityTypeManager();
       $entity_type = $this->getTargetEntityTypeId();
-      if ($entity_manager->hasHandler($entity_type, 'view_builder')) {
-        $entity_manager->getViewBuilder($entity_type)->resetCache();
+      if ($entity_type_manager->hasHandler($entity_type, 'view_builder')) {
+        $entity_type_manager->getViewBuilder($entity_type)->resetCache();
       }
     }
   }
@@ -707,7 +707,7 @@ public function isQueryable() {
    *   TRUE if the field has data for any entity; FALSE otherwise.
    */
   public function hasData() {
-    return \Drupal::entityManager()->getStorage($this->entity_type)->countFieldData($this, TRUE);
+    return \Drupal::entityTypeManager()->getStorage($this->entity_type)->countFieldData($this, TRUE);
   }
 
   /**
@@ -806,7 +806,7 @@ protected function getFieldItemClass() {
    *   otherwise NULL.
    */
   public static function loadByName($entity_type_id, $field_name) {
-    return \Drupal::entityManager()->getStorage('field_storage_config')->load($entity_type_id . '.' . $field_name);
+    return \Drupal::entityTypeManager()->getStorage('field_storage_config')->load($entity_type_id . '.' . $field_name);
   }
 
   /**
diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php
index 40d0bfa4720a..39dd1632db38 100644
--- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php
+++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php
@@ -163,7 +163,7 @@ public function testSupportedEntityTypesAndWidgets() {
       // default value deleted.
       $referenced_entities[0]->delete();
       // Reload the field since deleting the default value can change the field.
-      \Drupal::entityManager()->getStorage($field->getEntityTypeId())->resetCache([$field->id()]);
+      \Drupal::entityTypeManager()->getStorage($field->getEntityTypeId())->resetCache([$field->id()]);
       $field = FieldConfig::loadByName($this->entityType, $this->bundle, $this->fieldName);
       $this->assertConfigEntityImport($field);
 
diff --git a/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php b/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php
index 20544419e6c9..7b6fabe488c7 100644
--- a/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php
+++ b/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php
@@ -84,7 +84,7 @@ public function testFieldAdminHandler() {
     $this->assertFieldByName('settings[target_type]', 'node');
 
     // Check that all entity types can be referenced.
-    $this->assertFieldSelectOptions('settings[target_type]', array_keys(\Drupal::entityManager()->getDefinitions()));
+    $this->assertFieldSelectOptions('settings[target_type]', array_keys(\Drupal::entityTypeManager()->getDefinitions()));
 
     // Second step: 'Field settings' form.
     $this->drupalPostForm(NULL, [], t('Save field settings'));
diff --git a/core/modules/field/tests/src/Kernel/BulkDeleteTest.php b/core/modules/field/tests/src/Kernel/BulkDeleteTest.php
index 1c5a4aea4b53..fb0e87d0f004 100644
--- a/core/modules/field/tests/src/Kernel/BulkDeleteTest.php
+++ b/core/modules/field/tests/src/Kernel/BulkDeleteTest.php
@@ -278,7 +278,7 @@ public function testPurgeWithDeletedAndActiveField() {
     }
 
     // Check that the two field storages have different tables.
-    $storage = \Drupal::entityManager()->getStorage($this->entityTypeId);
+    $storage = \Drupal::entityTypeManager()->getStorage($this->entityTypeId);
     /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
     $table_mapping = $storage->getTableMapping();
     $deleted_table_name = $table_mapping->getDedicatedDataTableName($deleted_field_storage, TRUE);
diff --git a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php
index 2b191e9c7923..b42d83c13db0 100644
--- a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php
+++ b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php
@@ -213,7 +213,7 @@ public function testEntityFormatter() {
 ';
     $renderer->renderRoot($build[0]);
     $this->assertEqual($build[0]['#markup'], 'default | ' . $this->referencedEntity->label() . $expected_rendered_name_field_1 . $expected_rendered_body_field_1, sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter));
-    $expected_cache_tags = Cache::mergeTags(\Drupal::entityManager()->getViewBuilder($this->entityType)->getCacheTags(), $this->referencedEntity->getCacheTags());
+    $expected_cache_tags = Cache::mergeTags(\Drupal::entityTypeManager()->getViewBuilder($this->entityType)->getCacheTags(), $this->referencedEntity->getCacheTags());
     $expected_cache_tags = Cache::mergeTags($expected_cache_tags, FilterFormat::load('full_html')->getCacheTags());
     $this->assertEqual($build[0]['#cache']['tags'], $expected_cache_tags, format_string('The @formatter formatter has the expected cache tags.', ['@formatter' => $formatter]));
 
diff --git a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php
index 5c8c667f5e51..f8f57dfe8b92 100644
--- a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php
+++ b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php
@@ -242,7 +242,7 @@ public function testContentEntityReferenceItemWithStringId() {
     $entity = EntityTest::create();
     $entity->field_test_entity_test_string_id->target_id = $this->entityStringId->id();
     $entity->save();
-    $storage = \Drupal::entityManager()->getStorage('entity_test');
+    $storage = \Drupal::entityTypeManager()->getStorage('entity_test');
     $storage->resetCache();
     $this->assertEqual($this->entityStringId->id(), $storage->load($entity->id())->field_test_entity_test_string_id->target_id);
     // Verify that the label for the target ID property definition is correct.
diff --git a/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php b/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php
index c3b1f9305454..a8b087461d89 100644
--- a/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php
@@ -343,7 +343,7 @@ public function testEntityFormDisplayExtractFormValues() {
     $values_2[1]['value'] = 0;
 
     // Pretend the form has been built.
-    $form_state->setFormObject(\Drupal::entityManager()->getFormObject($entity_type, 'default'));
+    $form_state->setFormObject(\Drupal::entityTypeManager()->getFormObject($entity_type, 'default'));
     \Drupal::formBuilder()->prepareForm('field_test_entity_form', $form, $form_state);
     \Drupal::formBuilder()->processForm('field_test_entity_form', $form, $form_state);
     $form_state->setValue($this->fieldTestData->field_name, $values);
diff --git a/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php b/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
index 04d997d77d6f..7aa6359c7f7b 100644
--- a/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
@@ -127,7 +127,7 @@ public function testFieldAttachLoadMultiple() {
     }
 
     // Check that a single load correctly loads field values for both entities.
-    $controller = \Drupal::entityManager()->getStorage($entity->getEntityTypeId());
+    $controller = \Drupal::entityTypeManager()->getStorage($entity->getEntityTypeId());
     $controller->resetCache();
     $entities = $controller->loadMultiple();
     foreach ($entities as $index => $entity) {
diff --git a/core/modules/field/tests/src/Kernel/FieldDataCountTest.php b/core/modules/field/tests/src/Kernel/FieldDataCountTest.php
index 82ef6d09f0aa..3224763293f0 100644
--- a/core/modules/field/tests/src/Kernel/FieldDataCountTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldDataCountTest.php
@@ -39,9 +39,9 @@ class FieldDataCountTest extends FieldKernelTestBase {
   protected function setUp() {
     parent::setUp();
     $this->installEntitySchema('entity_test_rev');
-    $this->storage = \Drupal::entityManager()->getStorage('entity_test');
-    $this->storageRev = \Drupal::entityManager()->getStorage('entity_test_rev');
-    $this->storageUser = \Drupal::entityManager()->getStorage('user');
+    $this->storage = \Drupal::entityTypeManager()->getStorage('entity_test');
+    $this->storageRev = \Drupal::entityTypeManager()->getStorage('entity_test_rev');
+    $this->storageUser = \Drupal::entityTypeManager()->getStorage('user');
   }
 
   /**
@@ -83,7 +83,7 @@ public function testEntityCountAndHasData() {
       $entity->save();
     }
 
-    $storage = \Drupal::entityManager()->getStorage('entity_test');
+    $storage = \Drupal::entityTypeManager()->getStorage('entity_test');
     if ($storage instanceof SqlContentEntityStorage) {
       // Count the actual number of rows in the field table.
       $table_mapping = $storage->getTableMapping();
diff --git a/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php b/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
index b4180a0170ca..cfede1e38615 100644
--- a/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
@@ -82,19 +82,19 @@ public function testImportDelete() {
     $this->configImporter()->import();
 
     // Check that the field storages and fields are gone.
-    \Drupal::entityManager()->getStorage('field_storage_config')->resetCache([$field_storage_id]);
+    \Drupal::entityTypeManager()->getStorage('field_storage_config')->resetCache([$field_storage_id]);
     $field_storage = FieldStorageConfig::load($field_storage_id);
     $this->assertFalse($field_storage, 'The field storage was deleted.');
-    \Drupal::entityManager()->getStorage('field_storage_config')->resetCache([$field_storage_id_2]);
+    \Drupal::entityTypeManager()->getStorage('field_storage_config')->resetCache([$field_storage_id_2]);
     $field_storage_2 = FieldStorageConfig::load($field_storage_id_2);
     $this->assertFalse($field_storage_2, 'The second field storage was deleted.');
-    \Drupal::entityManager()->getStorage('field_config')->resetCache([$field_id]);
+    \Drupal::entityTypeManager()->getStorage('field_config')->resetCache([$field_id]);
     $field = FieldConfig::load($field_id);
     $this->assertFalse($field, 'The field was deleted.');
-    \Drupal::entityManager()->getStorage('field_config')->resetCache([$field_id_2a]);
+    \Drupal::entityTypeManager()->getStorage('field_config')->resetCache([$field_id_2a]);
     $field_2a = FieldConfig::load($field_id_2a);
     $this->assertFalse($field_2a, 'The second field on test bundle was deleted.');
-    \Drupal::entityManager()->getStorage('field_config')->resetCache([$field_id_2b]);
+    \Drupal::entityTypeManager()->getStorage('field_config')->resetCache([$field_id_2b]);
     $field_2b = FieldConfig::load($field_id_2b);
     $this->assertFalse($field_2b, 'The second field on test bundle 2 was deleted.');
 
diff --git a/core/modules/field/tests/src/Kernel/FieldKernelTestBase.php b/core/modules/field/tests/src/Kernel/FieldKernelTestBase.php
index 65dcd9aa5af9..92dd7d7a31db 100644
--- a/core/modules/field/tests/src/Kernel/FieldKernelTestBase.php
+++ b/core/modules/field/tests/src/Kernel/FieldKernelTestBase.php
@@ -52,7 +52,7 @@ protected function setUp() {
     $this->installConfig(['field', 'system']);
 
     // Create user 1.
-    $storage = \Drupal::entityManager()->getStorage('user');
+    $storage = \Drupal::entityTypeManager()->getStorage('user');
     $storage
       ->create([
         'uid' => 1,
diff --git a/core/modules/field/tests/src/Kernel/Timestamp/TimestampFormatterTest.php b/core/modules/field/tests/src/Kernel/Timestamp/TimestampFormatterTest.php
index 1734a7213b96..d7a771729d51 100644
--- a/core/modules/field/tests/src/Kernel/Timestamp/TimestampFormatterTest.php
+++ b/core/modules/field/tests/src/Kernel/Timestamp/TimestampFormatterTest.php
@@ -103,7 +103,7 @@ public function testTimestampFormatter() {
     $data = [];
 
     // Test standard formats.
-    $date_formats = array_keys(\Drupal::entityManager()->getStorage('date_format')->loadMultiple());
+    $date_formats = array_keys(\Drupal::entityTypeManager()->getStorage('date_format')->loadMultiple());
 
     foreach ($date_formats as $date_format) {
       $data[] = ['date_format' => $date_format, 'custom_date_format' => '', 'timezone' => ''];
diff --git a/core/modules/field/tests/src/Kernel/TranslationTest.php b/core/modules/field/tests/src/Kernel/TranslationTest.php
index 31ee4b41fdef..605c5574b4aa 100644
--- a/core/modules/field/tests/src/Kernel/TranslationTest.php
+++ b/core/modules/field/tests/src/Kernel/TranslationTest.php
@@ -109,7 +109,7 @@ protected function setUp() {
   public function testTranslatableFieldSaveLoad() {
     // Enable field translations for nodes.
     field_test_entity_info_translatable('node', TRUE);
-    $entity_type = \Drupal::entityManager()->getDefinition('node');
+    $entity_type = \Drupal::entityTypeManager()->getDefinition('node');
     $this->assertTrue($entity_type->isTranslatable(), 'Nodes are translatable.');
 
     // Prepare the field translations.
@@ -203,7 +203,7 @@ public function testTranslatableFieldSaveLoad() {
    * @see https://www.drupal.org/node/2404739
    */
   public function testFieldAccess() {
-    $access_control_handler = \Drupal::entityManager()->getAccessControlHandler($this->entityType);
+    $access_control_handler = \Drupal::entityTypeManager()->getAccessControlHandler($this->entityType);
     $this->assertTrue($access_control_handler->fieldAccess('view', $this->field));
   }
 
diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module
index a73f15327166..488be766b20c 100644
--- a/core/modules/field_ui/field_ui.module
+++ b/core/modules/field_ui/field_ui.module
@@ -142,7 +142,7 @@ function field_ui_entity_operation(EntityInterface $entity) {
   $info = $entity->getEntityType();
   // Add manage fields and display links if this entity type is the bundle
   // of another and that type has field UI enabled.
-  if (($bundle_of = $info->getBundleOf()) && \Drupal::entityManager()->getDefinition($bundle_of)->get('field_ui_base_route')) {
+  if (($bundle_of = $info->getBundleOf()) && \Drupal::entityTypeManager()->getDefinition($bundle_of)->get('field_ui_base_route')) {
     $account = \Drupal::currentUser();
     if ($account->hasPermission('administer ' . $bundle_of . ' fields')) {
       $operations['manage-fields'] = [
diff --git a/core/modules/field_ui/src/FieldUI.php b/core/modules/field_ui/src/FieldUI.php
index b9351a4b77ff..0d5d7771dc30 100644
--- a/core/modules/field_ui/src/FieldUI.php
+++ b/core/modules/field_ui/src/FieldUI.php
@@ -23,7 +23,7 @@ class FieldUI {
    *   A URL object.
    */
   public static function getOverviewRouteInfo($entity_type_id, $bundle) {
-    $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id);
+    $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id);
     if ($entity_type->get('field_ui_base_route')) {
       return new Url("entity.{$entity_type_id}.field_ui_fields", static::getRouteBundleParameter($entity_type, $bundle));
     }
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index b3df37181854..93b277f3e4c2 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -87,7 +87,7 @@ function file_field_widget_info_alter(array &$info) {
 function file_load_multiple(array $fids = NULL, $reset = FALSE) {
   @trigger_error('file_load_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\file\Entity\File::loadMultiple(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
   if ($reset) {
-    \Drupal::entityManager()->getStorage('file')->resetCache($fids);
+    \Drupal::entityTypeManager()->getStorage('file')->resetCache($fids);
   }
   return File::loadMultiple($fids);
 }
@@ -112,7 +112,7 @@ function file_load_multiple(array $fids = NULL, $reset = FALSE) {
 function file_load($fid, $reset = FALSE) {
   @trigger_error('file_load() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\file\Entity\File::load(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
   if ($reset) {
-    \Drupal::entityManager()->getStorage('file')->resetCache([$fid]);
+    \Drupal::entityTypeManager()->getStorage('file')->resetCache([$fid]);
   }
   return File::load($fid);
 }
@@ -396,7 +396,7 @@ function file_validate_size(FileInterface $file, $file_limit = 0, $user_limit =
   }
 
   // Save a query by only calling spaceUsed() when a limit is provided.
-  if ($user_limit && (\Drupal::entityManager()->getStorage('file')->spaceUsed($user->id()) + $file->getSize()) > $user_limit) {
+  if ($user_limit && (\Drupal::entityTypeManager()->getStorage('file')->spaceUsed($user->id()) + $file->getSize()) > $user_limit) {
     $errors[] = t('The file is %filesize which would exceed your disk quota of %quota.', ['%filesize' => format_size($file->getSize()), '%quota' => format_size($user_limit)]);
   }
 
@@ -714,7 +714,7 @@ function file_file_download($uri) {
  */
 function file_cron() {
   $age = \Drupal::config('system.file')->get('temporary_maximum_age');
-  $file_storage = \Drupal::entityManager()->getStorage('file');
+  $file_storage = \Drupal::entityTypeManager()->getStorage('file');
 
   // Only delete temporary files if older than $age. Note that automatic cleanup
   // is disabled if $age set to 0.
diff --git a/core/modules/file/file.views.inc b/core/modules/file/file.views.inc
index 8e45101bd84a..f2c2482f5646 100644
--- a/core/modules/file/file.views.inc
+++ b/core/modules/file/file.views.inc
@@ -38,7 +38,7 @@ function file_field_views_data(FieldStorageConfigInterface $field_storage) {
  */
 function file_field_views_data_views_data_alter(array &$data, FieldStorageConfigInterface $field_storage) {
   $entity_type_id = $field_storage->getTargetEntityTypeId();
-  $entity_manager = \Drupal::entityManager();
+  $entity_manager = \Drupal::entityTypeManager();
   $entity_type = $entity_manager->getDefinition($entity_type_id);
   $field_name = $field_storage->getName();
   $pseudo_field_name = 'reverse_' . $field_name . '_' . $entity_type_id;
diff --git a/core/modules/file/src/Plugin/Field/FieldType/FileFieldItemList.php b/core/modules/file/src/Plugin/Field/FieldType/FileFieldItemList.php
index c7cf0f04e48c..ab936177bb38 100644
--- a/core/modules/file/src/Plugin/Field/FieldType/FileFieldItemList.php
+++ b/core/modules/file/src/Plugin/Field/FieldType/FileFieldItemList.php
@@ -60,7 +60,7 @@ public function postSave($update) {
 
       // Decrement file usage by 1 for files that were removed from the field.
       $removed_ids = array_filter(array_diff($original_ids, $ids));
-      $removed_files = \Drupal::entityManager()->getStorage('file')->loadMultiple($removed_ids);
+      $removed_files = \Drupal::entityTypeManager()->getStorage('file')->loadMultiple($removed_ids);
       foreach ($removed_files as $file) {
         \Drupal::service('file.usage')->delete($file, 'file', $entity->getEntityTypeId(), $entity->id());
       }
diff --git a/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php b/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php
index 7feaa507dab8..2b448ba7dbfb 100644
--- a/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php
+++ b/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php
@@ -142,7 +142,7 @@ public function testManagedFileRemoved() {
     $this->drupalPostForm(NULL, $edit, t('Upload'));
 
     $fid = $this->getLastFileId();
-    $file = \Drupal::entityManager()->getStorage('file')->load($fid);
+    $file = \Drupal::entityTypeManager()->getStorage('file')->load($fid);
     $file->delete();
 
     $this->drupalPostForm(NULL, $edit, t('Upload'));
diff --git a/core/modules/file/tests/src/Functional/FilePrivateTest.php b/core/modules/file/tests/src/Functional/FilePrivateTest.php
index 2e5b0a1dac50..7a6824b1323e 100644
--- a/core/modules/file/tests/src/Functional/FilePrivateTest.php
+++ b/core/modules/file/tests/src/Functional/FilePrivateTest.php
@@ -46,7 +46,7 @@ public function testPrivateFile() {
 
     $test_file = $this->getTestFile('text');
     $nid = $this->uploadNodeFile($test_file, $field_name, $type_name, TRUE, ['private' => TRUE]);
-    \Drupal::entityManager()->getStorage('node')->resetCache([$nid]);
+    \Drupal::entityTypeManager()->getStorage('node')->resetCache([$nid]);
     /* @var \Drupal\node\NodeInterface $node */
     $node = $node_storage->load($nid);
     $node_file = File::load($node->{$field_name}->target_id);
@@ -67,7 +67,7 @@ public function testPrivateFile() {
     // Test with the field that should deny access through field access.
     $this->drupalLogin($this->adminUser);
     $nid = $this->uploadNodeFile($test_file, $no_access_field_name, $type_name, TRUE, ['private' => TRUE]);
-    \Drupal::entityManager()->getStorage('node')->resetCache([$nid]);
+    \Drupal::entityTypeManager()->getStorage('node')->resetCache([$nid]);
     $node = $node_storage->load($nid);
     $node_file = File::load($node->{$no_access_field_name}->target_id);
 
diff --git a/core/modules/file/tests/src/Functional/PrivateFileOnTranslatedEntityTest.php b/core/modules/file/tests/src/Functional/PrivateFileOnTranslatedEntityTest.php
index ab31eb757f3a..44b2ee10c9c7 100644
--- a/core/modules/file/tests/src/Functional/PrivateFileOnTranslatedEntityTest.php
+++ b/core/modules/file/tests/src/Functional/PrivateFileOnTranslatedEntityTest.php
@@ -87,7 +87,7 @@ public function testPrivateLanguageFile() {
     $this->rebuildContainer();
 
     // Ensure the file can be downloaded.
-    \Drupal::entityManager()->getStorage('node')->resetCache([$default_language_node->id()]);
+    \Drupal::entityTypeManager()->getStorage('node')->resetCache([$default_language_node->id()]);
     $node = Node::load($default_language_node->id());
     $node_file = File::load($node->{$this->fieldName}->target_id);
     $this->drupalGet(file_create_url($node_file->getFileUri()));
@@ -109,7 +109,7 @@ public function testPrivateLanguageFile() {
     $last_fid = $this->getLastFileId();
 
     // Verify the translation was created.
-    \Drupal::entityManager()->getStorage('node')->resetCache([$default_language_node->id()]);
+    \Drupal::entityTypeManager()->getStorage('node')->resetCache([$default_language_node->id()]);
     $default_language_node = Node::load($default_language_node->id());
     $this->assertTrue($default_language_node->hasTranslation('fr'), 'Node found in database.');
     $this->assertTrue($last_fid > $last_fid_prior, 'New file got saved.');
diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module
index 3246f10db811..4d72ff1625ae 100644
--- a/core/modules/filter/filter.module
+++ b/core/modules/filter/filter.module
@@ -103,9 +103,9 @@ function filter_formats(AccountInterface $account = NULL) {
       $formats['all'] = $cache->data;
     }
     else {
-      $formats['all'] = \Drupal::entityManager()->getStorage('filter_format')->loadByProperties(['status' => TRUE]);
+      $formats['all'] = \Drupal::entityTypeManager()->getStorage('filter_format')->loadByProperties(['status' => TRUE]);
       uasort($formats['all'], 'Drupal\Core\Config\Entity\ConfigEntityBase::sort');
-      \Drupal::cache()->set("filter_formats:{$language_interface->getId()}", $formats['all'], Cache::PERMANENT, \Drupal::entityManager()->getDefinition('filter_format')->getListCacheTags());
+      \Drupal::cache()->set("filter_formats:{$language_interface->getId()}", $formats['all'], Cache::PERMANENT, \Drupal::entityTypeManager()->getDefinition('filter_format')->getListCacheTags());
     }
   }
 
diff --git a/core/modules/filter/tests/src/Kernel/FilterAPITest.php b/core/modules/filter/tests/src/Kernel/FilterAPITest.php
index 8ce4fa910897..ed6bff8668dd 100644
--- a/core/modules/filter/tests/src/Kernel/FilterAPITest.php
+++ b/core/modules/filter/tests/src/Kernel/FilterAPITest.php
@@ -487,7 +487,7 @@ public function testDependencyRemoval() {
     $this->assertTrue(isset($filters['filter_test_restrict_tags_and_attributes']), 'The filter plugin filter_test_restrict_tags_and_attributes is configured by the filtered_html filter format.');
 
     drupal_static_reset('filter_formats');
-    \Drupal::entityManager()->getStorage('filter_format')->resetCache();
+    \Drupal::entityTypeManager()->getStorage('filter_format')->resetCache();
     $module_data = \Drupal::service('extension.list.module')->reset()->getList();
     $this->assertFalse(isset($module_data['filter_test']->info['required']), 'The filter_test module is required.');
 
@@ -500,7 +500,7 @@ public function testDependencyRemoval() {
 
     // Verify the filter format still exists but the dependency and filter is
     // gone.
-    \Drupal::entityManager()->getStorage('filter_format')->resetCache();
+    \Drupal::entityTypeManager()->getStorage('filter_format')->resetCache();
     $filter_format = FilterFormat::load('filtered_html');
     $this->assertEqual([], $filter_format->getDependencies());
     // Use the get method since the FilterFormat::filters() method only returns
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index 108ee648e2e7..f75a810b13f3 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -472,7 +472,7 @@ function template_preprocess_forums(&$variables) {
         $variables['topics'][$id]->new_url = '';
 
         if ($topic->new_replies) {
-          $page_number = \Drupal::entityManager()->getStorage('comment')
+          $page_number = \Drupal::entityTypeManager()->getStorage('comment')
             ->getNewCommentPageNumber($topic->comment_count, $topic->new_replies, $topic, 'comment_forum');
           $query = $page_number ? ['page' => $page_number] : NULL;
           $variables['topics'][$id]->new_text = \Drupal::translation()->formatPlural($topic->new_replies, '1 new post<span class="visually-hidden"> in topic %title</span>', '@count new posts<span class="visually-hidden"> in topic %title</span>', ['%title' => $variables['topics'][$id]->label()]);
diff --git a/core/modules/image/image.views.inc b/core/modules/image/image.views.inc
index cca0e3d904de..483f989faf9f 100644
--- a/core/modules/image/image.views.inc
+++ b/core/modules/image/image.views.inc
@@ -39,11 +39,11 @@ function image_field_views_data(FieldStorageConfigInterface $field_storage) {
 function image_field_views_data_views_data_alter(array &$data, FieldStorageConfigInterface $field_storage) {
   $entity_type_id = $field_storage->getTargetEntityTypeId();
   $field_name = $field_storage->getName();
-  $entity_manager = \Drupal::entityManager();
-  $entity_type = $entity_manager->getDefinition($entity_type_id);
+  $entity_type_manager = \Drupal::entityTypeManager();
+  $entity_type = $entity_type_manager->getDefinition($entity_type_id);
   $pseudo_field_name = 'reverse_' . $field_name . '_' . $entity_type_id;
   /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
-  $table_mapping = $entity_manager->getStorage($entity_type_id)->getTableMapping();
+  $table_mapping = $entity_type_manager->getStorage($entity_type_id)->getTableMapping();
 
   list($label) = views_entity_field_label($entity_type_id, $field_name);
 
diff --git a/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php b/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php
index ba4677d7ea0b..3880a689615f 100644
--- a/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php
+++ b/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php
@@ -481,7 +481,7 @@ public static function validateDefaultImageForm(array &$element, FormStateInterf
     if (isset($element['fids']['#value'][0])) {
       $value = $element['fids']['#value'][0];
       // Convert the file ID to a uuid.
-      if ($file = \Drupal::entityManager()->getStorage('file')->load($value)) {
+      if ($file = \Drupal::entityTypeManager()->getStorage('file')->load($value)) {
         $value = $file->uuid();
       }
     }
diff --git a/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php b/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php
index 2dde5527886a..47aa51fa15c7 100644
--- a/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php
+++ b/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php
@@ -326,7 +326,7 @@ public function onDependencyRemoval(array $dependencies) {
     if ($style_id && $style = ImageStyle::load($style_id)) {
       if (!empty($dependencies[$style->getConfigDependencyKey()][$style->getConfigDependencyName()])) {
         /** @var \Drupal\image\ImageStyleStorageInterface $storage */
-        $storage = \Drupal::entityManager()->getStorage($style->getEntityTypeId());
+        $storage = \Drupal::entityTypeManager()->getStorage($style->getEntityTypeId());
         $replacement_id = $storage->getReplacementId($style_id);
         // If a valid replacement has been provided in the storage, replace the
         // preview image style with the replacement.
diff --git a/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php b/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php
index b2d6f1033ff5..bea8773efbcf 100644
--- a/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php
@@ -748,7 +748,7 @@ public function testWrite() {
     $this->assertEquals("The current user is not allowed to PATCH the selected field (status). The 'administer nodes' permission is required.",
       $updated_response['errors'][0]['detail']);
 
-    $node = \Drupal::entityManager()->loadEntityByUuid('node', $uuid);
+    $node = \Drupal::service('entity.repository')->loadEntityByUuid('node', $uuid);
     $this->assertEquals(1, $node->get('status')->value, 'Node status was not changed.');
     // 9. Successful POST to related endpoint.
     $body = [
diff --git a/core/modules/language/language.module b/core/modules/language/language.module
index 0df467dc1435..368248c75b61 100644
--- a/core/modules/language/language.module
+++ b/core/modules/language/language.module
@@ -330,7 +330,7 @@ function language_modules_installed($modules) {
     // this is not a hard dependency, and thus is not detected by the config
     // system, we have to clean up the related values manually.
     foreach (['entity_view_display', 'entity_form_display'] as $key) {
-      $displays = \Drupal::entityManager()->getStorage($key)->loadMultiple();
+      $displays = \Drupal::entityTypeManager()->getStorage($key)->loadMultiple();
       /** @var \Drupal\Core\Entity\Display\EntityDisplayInterface $display */
       foreach ($displays as $display) {
         $display->save();
diff --git a/core/modules/language/src/Entity/ContentLanguageSettings.php b/core/modules/language/src/Entity/ContentLanguageSettings.php
index 59803defe1a9..509dbaf3c711 100644
--- a/core/modules/language/src/Entity/ContentLanguageSettings.php
+++ b/core/modules/language/src/Entity/ContentLanguageSettings.php
@@ -190,7 +190,7 @@ public static function loadByEntityTypeBundle($entity_type_id, $bundle) {
     if ($entity_type_id == NULL || $bundle == NULL) {
       return NULL;
     }
-    $config = \Drupal::entityManager()->getStorage('language_content_settings')->load($entity_type_id . '.' . $bundle);
+    $config = \Drupal::entityTypeManager()->getStorage('language_content_settings')->load($entity_type_id . '.' . $bundle);
     if ($config == NULL) {
       $config = ContentLanguageSettings::create(['target_entity_type_id' => $entity_type_id, 'target_bundle' => $bundle]);
     }
@@ -204,7 +204,7 @@ public function calculateDependencies() {
     parent::calculateDependencies();
 
     // Create dependency on the bundle.
-    $entity_type = \Drupal::entityManager()->getDefinition($this->target_entity_type_id);
+    $entity_type = \Drupal::entityTypeManager()->getDefinition($this->target_entity_type_id);
     $bundle_config_dependency = $entity_type->getBundleConfigDependency($this->target_bundle);
     $this->addDependency($bundle_config_dependency['type'], $bundle_config_dependency['name']);
 
diff --git a/core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php b/core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php
index 9e71064c0bd9..7d400cab4cba 100644
--- a/core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php
@@ -203,15 +203,15 @@ public function testNodeTypeDelete() {
     $this->drupalPostForm('admin/structure/types/manage/article', $edit, t('Save content type'));
 
     // Check the language default configuration for articles is present.
-    $configuration = \Drupal::entityManager()->getStorage('language_content_settings')->load('node.article');
+    $configuration = \Drupal::entityTypeManager()->getStorage('language_content_settings')->load('node.article');
     $this->assertTrue($configuration, 'The language configuration is present.');
 
     // Delete 'article' bundle.
     $this->drupalPostForm('admin/structure/types/manage/article/delete', [], t('Delete'));
 
     // Check that the language configuration has been deleted.
-    \Drupal::entityManager()->getStorage('language_content_settings')->resetCache();
-    $configuration = \Drupal::entityManager()->getStorage('language_content_settings')->load('node.article');
+    \Drupal::entityTypeManager()->getStorage('language_content_settings')->resetCache();
+    $configuration = \Drupal::entityTypeManager()->getStorage('language_content_settings')->load('node.article');
     $this->assertFalse($configuration, 'The language configuration was deleted after bundle was deleted.');
   }
 
diff --git a/core/modules/menu_link_content/menu_link_content.module b/core/modules/menu_link_content/menu_link_content.module
index a0ea8da55bff..559405dfbe9a 100644
--- a/core/modules/menu_link_content/menu_link_content.module
+++ b/core/modules/menu_link_content/menu_link_content.module
@@ -44,7 +44,7 @@ function menu_link_content_entity_type_alter(array &$entity_types) {
  * Implements hook_menu_delete().
  */
 function menu_link_content_menu_delete(MenuInterface $menu) {
-  $storage = \Drupal::entityManager()->getStorage('menu_link_content');
+  $storage = \Drupal::entityTypeManager()->getStorage('menu_link_content');
   $menu_links = $storage->loadByProperties(['menu_name' => $menu->id()]);
   $storage->delete($menu_links);
 }
@@ -66,7 +66,7 @@ function _menu_link_content_update_path_alias($path) {
   /** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
   $menu_link_manager = \Drupal::service('plugin.manager.menu.link');
   /** @var \Drupal\menu_link_content\MenuLinkContentInterface[] $entities */
-  $entities = \Drupal::entityManager()
+  $entities = \Drupal::entityTypeManager()
     ->getStorage('menu_link_content')
     ->loadByProperties(['link.uri' => 'internal:' . $path]);
   foreach ($entities as $menu_link) {
diff --git a/core/modules/menu_ui/src/Tests/MenuWebTestBase.php b/core/modules/menu_ui/src/Tests/MenuWebTestBase.php
index a8b9862223df..136b246b1c35 100644
--- a/core/modules/menu_ui/src/Tests/MenuWebTestBase.php
+++ b/core/modules/menu_ui/src/Tests/MenuWebTestBase.php
@@ -37,7 +37,7 @@ public function assertMenuLink($menu_plugin_id, array $expected_item) {
     $menu_link_manager = \Drupal::service('plugin.manager.menu.link');
     $menu_link_manager->resetDefinitions();
     // Reset the static load cache.
-    \Drupal::entityManager()->getStorage('menu_link_content')->resetCache();
+    \Drupal::entityTypeManager()->getStorage('menu_link_content')->resetCache();
     $definition = $menu_link_manager->getDefinition($menu_plugin_id);
 
     $entity = NULL;
@@ -46,7 +46,7 @@ public function assertMenuLink($menu_plugin_id, array $expected_item) {
     if (strpos($menu_plugin_id, 'menu_link_content') === 0) {
       list(, $uuid) = explode(':', $menu_plugin_id, 2);
       /** @var \Drupal\menu_link_content\Entity\MenuLinkContent $entity */
-      $entity = \Drupal::entityManager()->loadEntityByUuid('menu_link_content', $uuid);
+      $entity = \Drupal::service('entity.repository')->loadEntityByUuid('menu_link_content', $uuid);
     }
 
     if (isset($expected_item['children'])) {
diff --git a/core/modules/menu_ui/tests/src/Functional/MenuUninstallTest.php b/core/modules/menu_ui/tests/src/Functional/MenuUninstallTest.php
index a0320f44b0ff..b2d64cece5c8 100644
--- a/core/modules/menu_ui/tests/src/Functional/MenuUninstallTest.php
+++ b/core/modules/menu_ui/tests/src/Functional/MenuUninstallTest.php
@@ -25,7 +25,7 @@ class MenuUninstallTest extends BrowserTestBase {
   public function testMenuUninstall() {
     \Drupal::service('module_installer')->uninstall(['menu_ui']);
 
-    \Drupal::entityManager()->getStorage('menu')->resetCache(['admin']);
+    \Drupal::entityTypeManager()->getStorage('menu')->resetCache(['admin']);
 
     $this->assertTrue(Menu::load('admin'), 'The \'admin\' menu still exists after uninstalling Menu UI module.');
   }
diff --git a/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php
index b0f2fa8a1a1d..c3a0506419d5 100644
--- a/core/modules/migrate/src/MigrateExecutable.php
+++ b/core/modules/migrate/src/MigrateExecutable.php
@@ -546,9 +546,9 @@ protected function attemptMemoryReclaim() {
     drupal_static_reset();
 
     // Entity storage can blow up with caches so clear them out.
-    $manager = \Drupal::entityManager();
-    foreach ($manager->getDefinitions() as $id => $definition) {
-      $manager->getStorage($id)->resetCache();
+    $entity_type_manager = \Drupal::entityTypeManager();
+    foreach ($entity_type_manager->getDefinitions() as $id => $definition) {
+      $entity_type_manager->getStorage($id)->resetCache();
     }
 
     // @TODO: explore resetting the container.
diff --git a/core/modules/migrate_drupal/src/Tests/StubTestTrait.php b/core/modules/migrate_drupal/src/Tests/StubTestTrait.php
index 3bf00281a037..5a5fa043325f 100644
--- a/core/modules/migrate_drupal/src/Tests/StubTestTrait.php
+++ b/core/modules/migrate_drupal/src/Tests/StubTestTrait.php
@@ -65,7 +65,7 @@ protected function createStub($entity_type_id) {
    *   List of constraint violations identified.
    */
   protected function validateStub($entity_type_id, $entity_id) {
-    $controller = \Drupal::entityManager()->getStorage($entity_type_id);
+    $controller = \Drupal::entityTypeManager()->getStorage($entity_type_id);
     /** @var \Drupal\Core\Entity\ContentEntityInterface $stub_entity */
     $stub_entity = $controller->load($entity_id);
     return $stub_entity->validate();
diff --git a/core/modules/node/node.install b/core/modules/node/node.install
index 1380d63ae8ee..e05c841128f8 100644
--- a/core/modules/node/node.install
+++ b/core/modules/node/node.install
@@ -19,7 +19,7 @@ function node_requirements($phase) {
     // Only show rebuild button if there are either 0, or 2 or more, rows
     // in the {node_access} table, or if there are modules that
     // implement hook_node_grants().
-    $grant_count = \Drupal::entityManager()->getAccessControlHandler('node')->countGrants();
+    $grant_count = \Drupal::entityTypeManager()->getAccessControlHandler('node')->countGrants();
     if ($grant_count != 1 || count(\Drupal::moduleHandler()->getImplementations('node_grants')) > 0) {
       $value = \Drupal::translation()->formatPlural($grant_count, 'One permission in use', '@count permissions in use', ['@count' => $grant_count]);
     }
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index dfe5370faf2e..4560a7c66e85 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -431,7 +431,7 @@ function node_entity_extra_field_info() {
  *   The number of nodes whose node type field was modified.
  */
 function node_type_update_nodes($old_id, $new_id) {
-  return \Drupal::entityManager()->getStorage('node')->updateType($old_id, $new_id);
+  return \Drupal::entityTypeManager()->getStorage('node')->updateType($old_id, $new_id);
 }
 
 /**
@@ -458,7 +458,7 @@ function node_type_update_nodes($old_id, $new_id) {
 function node_load_multiple(array $nids = NULL, $reset = FALSE) {
   @trigger_error('node_load_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\node\Entity\Node::loadMultiple(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
   if ($reset) {
-    \Drupal::entityManager()->getStorage('node')->resetCache($nids);
+    \Drupal::entityTypeManager()->getStorage('node')->resetCache($nids);
   }
   return Node::loadMultiple($nids);
 }
@@ -483,7 +483,7 @@ function node_load_multiple(array $nids = NULL, $reset = FALSE) {
 function node_load($nid = NULL, $reset = FALSE) {
   @trigger_error('node_load() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\node\Entity\Node::load(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
   if ($reset) {
-    \Drupal::entityManager()->getStorage('node')->resetCache([$nid]);
+    \Drupal::entityTypeManager()->getStorage('node')->resetCache([$nid]);
   }
   return Node::load($nid);
 }
@@ -772,7 +772,7 @@ function node_user_cancel($edit, UserInterface $account, $method) {
     case 'user_cancel_reassign':
       // Anonymize all of the nodes for this old account.
       module_load_include('inc', 'node', 'node.admin');
-      $vids = \Drupal::entityManager()->getStorage('node')->userRevisionIds($account);
+      $vids = \Drupal::entityTypeManager()->getStorage('node')->userRevisionIds($account);
       node_mass_update($vids, [
         'uid' => 0,
         'revision_uid' => 0,
@@ -792,7 +792,7 @@ function node_user_predelete($account) {
     ->accessCheck(FALSE)
     ->execute();
   // Delete old revisions.
-  $storage_controller = \Drupal::entityManager()->getStorage('node');
+  $storage_controller = \Drupal::entityTypeManager()->getStorage('node');
   $nodes = $storage_controller->loadMultiple($nids);
   $storage_controller->delete($nodes);
   $revisions = $storage_controller->userRevisionIds($account);
@@ -1091,7 +1091,7 @@ function node_access_view_all_nodes($account = NULL) {
     $access[$account->id()] = TRUE;
   }
   else {
-    $access[$account->id()] = \Drupal::entityManager()->getAccessControlHandler('node')->checkAllGrants($account);
+    $access[$account->id()] = \Drupal::entityTypeManager()->getAccessControlHandler('node')->checkAllGrants($account);
   }
 
   return $access[$account->id()];
@@ -1235,9 +1235,9 @@ function node_access_needs_rebuild($rebuild = NULL) {
  * @see node_access_needs_rebuild()
  */
 function node_access_rebuild($batch_mode = FALSE) {
-  $node_storage = \Drupal::entityManager()->getStorage('node');
+  $node_storage = \Drupal::entityTypeManager()->getStorage('node');
   /** @var \Drupal\node\NodeAccessControlHandlerInterface $access_control_handler */
-  $access_control_handler = \Drupal::entityManager()->getAccessControlHandler('node');
+  $access_control_handler = \Drupal::entityTypeManager()->getAccessControlHandler('node');
   $access_control_handler->deleteGrants();
   // Only recalculate if the site is using a node_access module.
   if (count(\Drupal::moduleHandler()->getImplementations('node_grants'))) {
@@ -1301,7 +1301,7 @@ function node_access_rebuild($batch_mode = FALSE) {
  *   An array of contextual key/value information for rebuild batch process.
  */
 function _node_access_rebuild_batch_operation(&$context) {
-  $node_storage = \Drupal::entityManager()->getStorage('node');
+  $node_storage = \Drupal::entityTypeManager()->getStorage('node');
   if (empty($context['sandbox'])) {
     // Initiate multistep processing.
     $context['sandbox']['progress'] = 0;
@@ -1328,7 +1328,7 @@ function _node_access_rebuild_batch_operation(&$context) {
     // loads successfully.
     if (!empty($node)) {
       /** @var \Drupal\node\NodeAccessControlHandlerInterface $access_control_handler */
-      $access_control_handler = \Drupal::entityManager()->getAccessControlHandler('node');
+      $access_control_handler = \Drupal::entityTypeManager()->getAccessControlHandler('node');
       $grants = $access_control_handler->acquireGrants($node);
       \Drupal::service('node.grant_storage')->write($node, $grants);
     }
@@ -1408,7 +1408,7 @@ function node_modules_uninstalled($modules) {
  */
 function node_configurable_language_delete(ConfigurableLanguageInterface $language) {
   // On nodes with this language, unset the language.
-  \Drupal::entityManager()->getStorage('node')->clearRevisionsLanguage($language);
+  \Drupal::entityTypeManager()->getStorage('node')->clearRevisionsLanguage($language);
 }
 
 /**
diff --git a/core/modules/node/src/Entity/Node.php b/core/modules/node/src/Entity/Node.php
index b3d19d4e89ee..88bac5aadd5e 100644
--- a/core/modules/node/src/Entity/Node.php
+++ b/core/modules/node/src/Entity/Node.php
@@ -144,7 +144,7 @@ public function postSave(EntityStorageInterface $storage, $update = TRUE) {
     // is new.
     if ($this->isDefaultRevision()) {
       /** @var \Drupal\node\NodeAccessControlHandlerInterface $access_control_handler */
-      $access_control_handler = \Drupal::entityManager()->getAccessControlHandler('node');
+      $access_control_handler = \Drupal::entityTypeManager()->getAccessControlHandler('node');
       $grants = $access_control_handler->acquireGrants($this);
       \Drupal::service('node.grant_storage')->write($this, $grants, NULL, $update);
     }
diff --git a/core/modules/node/src/Tests/NodeTestBase.php b/core/modules/node/src/Tests/NodeTestBase.php
index e520b3283e7e..08e33e6f22d4 100644
--- a/core/modules/node/src/Tests/NodeTestBase.php
+++ b/core/modules/node/src/Tests/NodeTestBase.php
@@ -47,7 +47,7 @@ protected function setUp() {
       ]);
       $this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
     }
-    $this->accessHandler = \Drupal::entityManager()->getAccessControlHandler('node');
+    $this->accessHandler = \Drupal::entityTypeManager()->getAccessControlHandler('node');
   }
 
   /**
diff --git a/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php b/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php
index ad6cc549446d..6e7e0f216a4d 100644
--- a/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php
+++ b/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php
@@ -74,7 +74,7 @@ public function testForumPager() {
     $this->assertTrue($vid, 'Forum navigation vocabulary ID is set.');
 
     // Look up the general discussion term.
-    $tree = \Drupal::entityManager()->getStorage('taxonomy_term')->loadTree($vid, 0, 1);
+    $tree = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid, 0, 1);
     $tid = reset($tree)->tid;
     $this->assertTrue($tid, 'General discussion term is found in the forum vocabulary.');
 
diff --git a/core/modules/node/tests/src/Functional/NodeCreationTest.php b/core/modules/node/tests/src/Functional/NodeCreationTest.php
index f5b692083293..1ac6965fca51 100644
--- a/core/modules/node/tests/src/Functional/NodeCreationTest.php
+++ b/core/modules/node/tests/src/Functional/NodeCreationTest.php
@@ -34,7 +34,7 @@ protected function setUp() {
    * Creates a "Basic page" node and verifies its consistency in the database.
    */
   public function testNodeCreation() {
-    $node_type_storage = \Drupal::entityManager()->getStorage('node_type');
+    $node_type_storage = \Drupal::entityTypeManager()->getStorage('node_type');
 
     // Test /node/add page with only one content type.
     $node_type_storage->load('article')->delete();
@@ -248,7 +248,7 @@ public function testNodeAddWithoutContentTypes() {
     $this->assertNoLinkByHref('/admin/structure/types/add');
 
     // Test /node/add page without content types.
-    foreach (\Drupal::entityManager()->getStorage('node_type')->loadMultiple() as $entity) {
+    foreach (\Drupal::entityTypeManager()->getStorage('node_type')->loadMultiple() as $entity) {
       $entity->delete();
     }
 
diff --git a/core/modules/node/tests/src/Functional/NodeEditFormTest.php b/core/modules/node/tests/src/Functional/NodeEditFormTest.php
index 89f891a64317..642fba31b828 100644
--- a/core/modules/node/tests/src/Functional/NodeEditFormTest.php
+++ b/core/modules/node/tests/src/Functional/NodeEditFormTest.php
@@ -167,7 +167,7 @@ public function testNodeEditAuthoredBy() {
 
     // Now test with the Autocomplete (Tags) field widget.
     /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */
-    $form_display = \Drupal::entityManager()->getStorage('entity_form_display')->load('node.page.default');
+    $form_display = \Drupal::entityTypeManager()->getStorage('entity_form_display')->load('node.page.default');
     $widget = $form_display->getComponent('uid');
     $widget['type'] = 'entity_reference_autocomplete_tags';
     $widget['settings'] = [
diff --git a/core/modules/node/tests/src/Functional/NodeSaveTest.php b/core/modules/node/tests/src/Functional/NodeSaveTest.php
index 6c508aee68dd..64b38610d60c 100644
--- a/core/modules/node/tests/src/Functional/NodeSaveTest.php
+++ b/core/modules/node/tests/src/Functional/NodeSaveTest.php
@@ -44,7 +44,7 @@ protected function setUp() {
    */
   public function testImport() {
     // Node ID must be a number that is not in the database.
-    $nids = \Drupal::entityManager()->getStorage('node')->getQuery()
+    $nids = \Drupal::entityTypeManager()->getStorage('node')->getQuery()
       ->sort('nid', 'DESC')
       ->range(0, 1)
       ->execute();
diff --git a/core/modules/node/tests/src/Functional/NodeTemplateSuggestionsTest.php b/core/modules/node/tests/src/Functional/NodeTemplateSuggestionsTest.php
index dcadf934ded1..371cf1c32d6d 100644
--- a/core/modules/node/tests/src/Functional/NodeTemplateSuggestionsTest.php
+++ b/core/modules/node/tests/src/Functional/NodeTemplateSuggestionsTest.php
@@ -18,7 +18,7 @@ public function testNodeThemeHookSuggestions() {
     $view_mode = 'full';
 
     // Simulate theming of the node.
-    $build = \Drupal::entityManager()->getViewBuilder('node')->view($node, $view_mode);
+    $build = \Drupal::entityTypeManager()->getViewBuilder('node')->view($node, $view_mode);
 
     $variables['elements'] = $build;
     $suggestions = \Drupal::moduleHandler()->invokeAll('theme_suggestions_node', [$variables]);
@@ -27,7 +27,7 @@ public function testNodeThemeHookSuggestions() {
 
     // Change the view mode.
     $view_mode = 'node.my_custom_view_mode';
-    $build = \Drupal::entityManager()->getViewBuilder('node')->view($node, $view_mode);
+    $build = \Drupal::entityTypeManager()->getViewBuilder('node')->view($node, $view_mode);
 
     $variables['elements'] = $build;
     $suggestions = \Drupal::moduleHandler()->invokeAll('theme_suggestions_node', [$variables]);
diff --git a/core/modules/node/tests/src/Functional/NodeTestBase.php b/core/modules/node/tests/src/Functional/NodeTestBase.php
index e52708632b9e..264ac31535e2 100644
--- a/core/modules/node/tests/src/Functional/NodeTestBase.php
+++ b/core/modules/node/tests/src/Functional/NodeTestBase.php
@@ -40,7 +40,7 @@ protected function setUp() {
       ]);
       $this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
     }
-    $this->accessHandler = \Drupal::entityManager()->getAccessControlHandler('node');
+    $this->accessHandler = \Drupal::entityTypeManager()->getAccessControlHandler('node');
   }
 
   /**
diff --git a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
index 3348ad9d907b..00722fdfff08 100644
--- a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
+++ b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
@@ -279,7 +279,7 @@ public function testTranslationRendering() {
     $default_langcode = $this->langcodes[0];
     $values[$default_langcode] = $this->getNewEntityValues($default_langcode);
     $this->entityId = $this->createEntity($values[$default_langcode], $default_langcode);
-    $node = \Drupal::entityManager()->getStorage($this->entityTypeId)->load($this->entityId);
+    $node = \Drupal::entityTypeManager()->getStorage($this->entityTypeId)->load($this->entityId);
     $node->setPromoted(TRUE);
 
     // Create translations.
@@ -298,7 +298,7 @@ public function testTranslationRendering() {
     $this->doTestTranslations('node', $values);
 
     // Enable the translation language renderer.
-    $view = \Drupal::entityManager()->getStorage('view')->load('frontpage');
+    $view = \Drupal::entityTypeManager()->getStorage('view')->load('frontpage');
     $display = &$view->getDisplay('default');
     $display['display_options']['rendering_language'] = '***LANGUAGE_entity_translation***';
     $view->save();
diff --git a/core/modules/node/tests/src/Functional/Views/BulkFormAccessTest.php b/core/modules/node/tests/src/Functional/Views/BulkFormAccessTest.php
index 19c409719d06..a51fe21b7477 100644
--- a/core/modules/node/tests/src/Functional/Views/BulkFormAccessTest.php
+++ b/core/modules/node/tests/src/Functional/Views/BulkFormAccessTest.php
@@ -47,7 +47,7 @@ protected function setUp($import_test_views = TRUE) {
     // Create Article node type.
     $this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
 
-    $this->accessHandler = \Drupal::entityManager()->getAccessControlHandler('node');
+    $this->accessHandler = \Drupal::entityTypeManager()->getAccessControlHandler('node');
 
     node_access_test_add_field(NodeType::load('article'));
 
diff --git a/core/modules/node/tests/src/Functional/Views/NodeRevisionWizardTest.php b/core/modules/node/tests/src/Functional/Views/NodeRevisionWizardTest.php
index 3a3c5723a68d..2dc97b00c33c 100644
--- a/core/modules/node/tests/src/Functional/Views/NodeRevisionWizardTest.php
+++ b/core/modules/node/tests/src/Functional/Views/NodeRevisionWizardTest.php
@@ -19,7 +19,7 @@ class NodeRevisionWizardTest extends WizardTestBase {
   public function testViewAdd() {
     $this->drupalCreateContentType(['type' => 'article']);
     // Create two nodes with two revision.
-    $node_storage = \Drupal::entityManager()->getStorage('node');
+    $node_storage = \Drupal::entityTypeManager()->getStorage('node');
     /** @var \Drupal\node\NodeInterface $node */
     $node = $node_storage->create(['title' => $this->randomString(), 'type' => 'article', 'changed' => REQUEST_TIME + 40]);
     $node->save();
diff --git a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php
index 47366b788a26..131219a710ab 100644
--- a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php
+++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php
@@ -26,7 +26,7 @@ protected function setUp() {
    * Test node revisions migration from Drupal 6 to 8.
    */
   public function testNodeRevision() {
-    $node = \Drupal::entityManager()->getStorage('node')->loadRevision(2001);
+    $node = \Drupal::entityTypeManager()->getStorage('node')->loadRevision(2001);
     /** @var \Drupal\node\NodeInterface $node */
     $this->assertIdentical('1', $node->id());
     $this->assertIdentical('2001', $node->getRevisionId());
@@ -38,7 +38,7 @@ public function testNodeRevision() {
     $this->assertIdentical('modified rev 2', $node->revision_log->value);
     $this->assertIdentical('1390095702', $node->getRevisionCreationTime());
 
-    $node = \Drupal::entityManager()->getStorage('node')->loadRevision(5);
+    $node = \Drupal::entityTypeManager()->getStorage('node')->loadRevision(5);
     $this->assertIdentical('1', $node->id());
     $this->assertIdentical('body test rev 3', $node->body->value);
     $this->assertIdentical('1', $node->getRevisionUser()->id());
diff --git a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php
index 997df83b52fc..c390af2db4ed 100644
--- a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php
+++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php
@@ -60,7 +60,7 @@ public function testNode() {
     $this->assertIdentical('1420861423', $node->getRevisionCreationTime());
 
     /** @var \Drupal\node\NodeInterface $node_revision */
-    $node_revision = \Drupal::entityManager()->getStorage('node')->loadRevision(1);
+    $node_revision = \Drupal::entityTypeManager()->getStorage('node')->loadRevision(1);
     $this->assertIdentical('Test title', $node_revision->getTitle());
     $this->assertIdentical('1', $node_revision->getRevisionUser()->id(), 'Node revision has the correct user');
     $this->assertSame('1', $node_revision->id(), 'Node 1 loaded.');
diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php
index 0e6600603215..7caeb7242783 100644
--- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php
+++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php
@@ -131,7 +131,7 @@ protected function assertEntity($id, $type, $langcode, $title, $uid, $status, $c
    *   The revision's time stamp.
    */
   protected function assertRevision($id, $title, $uid, $log, $timestamp) {
-    $revision = \Drupal::entityManager()->getStorage('node')->loadRevision($id);
+    $revision = \Drupal::entityTypeManager()->getStorage('node')->loadRevision($id);
     $this->assertInstanceOf(NodeInterface::class, $revision);
     $this->assertEquals($title, $revision->getTitle());
     $this->assertEquals($uid, $revision->getRevisionUser()->id());
diff --git a/core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php b/core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php
index 1b8699198e6b..06709021c628 100644
--- a/core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php
+++ b/core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php
@@ -73,7 +73,7 @@ public function testNodeAccess() {
     $this->assertNodeAccess($expected_node_access, $node_public_no_language, $web_user);
 
     // Reset the node access cache and turn on our test node access code.
-    \Drupal::entityManager()->getAccessControlHandler('node')->resetCache();
+    \Drupal::entityTypeManager()->getAccessControlHandler('node')->resetCache();
     \Drupal::state()->set('node_access_test_secret_catalan', 1);
     $node_public_ca = $this->drupalCreateNode(['body' => [[]], 'langcode' => 'ca', 'private' => FALSE]);
     $this->assertTrue($node_public_ca->language()->getId() == 'ca', 'Node created as Catalan.');
@@ -97,7 +97,7 @@ public function testNodeAccess() {
     $this->assertNodeAccess($expected_node_access_no_access, $node_public_ca, $web_user);
     $this->assertNodeAccess($expected_node_access_no_access, $node_public_ca->getTranslation('ca'), $web_user);
 
-    \Drupal::entityManager()->getAccessControlHandler('node')->resetCache();
+    \Drupal::entityTypeManager()->getAccessControlHandler('node')->resetCache();
 
     // Tests that access is granted if requested with no language.
     $this->assertNodeAccess($expected_node_access, $node_public_no_language, $web_user);
@@ -142,7 +142,7 @@ public function testNodeAccessPrivate() {
     $this->assertNodeAccess($expected_node_access_no_access, $node_private_no_language, $web_user);
 
     // Reset the node access cache and turn on our test node access code.
-    \Drupal::entityManager()->getAccessControlHandler('node')->resetCache();
+    \Drupal::entityTypeManager()->getAccessControlHandler('node')->resetCache();
     \Drupal::state()->set('node_access_test_secret_catalan', 1);
 
     // Tests that access is not granted if requested with no language.
@@ -160,7 +160,7 @@ public function testNodeAccessPrivate() {
     $this->assertNodeAccess($expected_node_access_no_access, $node_private_ca, $private_ca_user);
     $this->assertNodeAccess($expected_node_access_no_access, $node_private_ca->getTranslation('ca'), $private_ca_user);
 
-    \Drupal::entityManager()->getAccessControlHandler('node')->resetCache();
+    \Drupal::entityTypeManager()->getAccessControlHandler('node')->resetCache();
     \Drupal::state()->set('node_access_test_secret_catalan', 0);
 
     // Tests that Catalan is still not accessible for a user with no access to
diff --git a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php
index 3699995dc504..2424374570bd 100644
--- a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php
+++ b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php
@@ -138,7 +138,7 @@ public function testUserPermissions() {
     $nid = $this->testNode->id();
     // There should be only one revision so far.
     $node = Node::load($nid);
-    $vids = \Drupal::entityManager()->getStorage('node')->revisionIds($node);
+    $vids = \Drupal::entityTypeManager()->getStorage('node')->revisionIds($node);
     $this->assertCount(1, $vids, 'The node has only one revision.');
     $original_log = $node->revision_log->value;
 
@@ -164,7 +164,7 @@ public function testUserPermissions() {
     $assert->assertWaitOnAjaxRequest();
 
     $node = Node::load($nid);
-    $vids = \Drupal::entityManager()->getStorage('node')->revisionIds($node);
+    $vids = \Drupal::entityTypeManager()->getStorage('node')->revisionIds($node);
     $this->assertCount(1, $vids, 'The node has only one revision.');
     $this->assertSame($original_log, $node->revision_log->value, 'The revision log message is unchanged.');
 
diff --git a/core/modules/rdf/src/Entity/RdfMapping.php b/core/modules/rdf/src/Entity/RdfMapping.php
index a4f268f8120c..e33f24a59a50 100644
--- a/core/modules/rdf/src/Entity/RdfMapping.php
+++ b/core/modules/rdf/src/Entity/RdfMapping.php
@@ -145,7 +145,7 @@ public function calculateDependencies() {
     parent::calculateDependencies();
 
     // Create dependency on the bundle.
-    $entity_type = \Drupal::entityManager()->getDefinition($this->targetEntityType);
+    $entity_type = \Drupal::entityTypeManager()->getDefinition($this->targetEntityType);
     $this->addDependency('module', $entity_type->getProvider());
     $bundle_config_dependency = $entity_type->getBundleConfigDependency($this->bundle);
     $this->addDependency($bundle_config_dependency['type'], $bundle_config_dependency['name']);
@@ -159,8 +159,8 @@ public function calculateDependencies() {
   public function postSave(EntityStorageInterface $storage, $update = TRUE) {
     parent::postSave($storage, $update);
 
-    if (\Drupal::entityManager()->hasHandler($this->targetEntityType, 'view_builder')) {
-      \Drupal::entityManager()->getViewBuilder($this->targetEntityType)->resetCache();
+    if (\Drupal::entityTypeManager()->hasHandler($this->targetEntityType, 'view_builder')) {
+      \Drupal::entityTypeManager()->getViewBuilder($this->targetEntityType)->resetCache();
     }
   }
 
diff --git a/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php b/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php
index 8dccf3e26ab4..40aa3e9994fb 100644
--- a/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php
+++ b/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php
@@ -228,7 +228,7 @@ public function testDefaultSearchPageOrdering() {
    */
   public function testMultipleSearchPages() {
     $this->assertDefaultSearch('node_search', 'The default page is set to the installer default.');
-    $search_storage = \Drupal::entityManager()->getStorage('search_page');
+    $search_storage = \Drupal::entityTypeManager()->getStorage('search_page');
     $entities = $search_storage->loadMultiple();
     $search_storage->delete($entities);
     $this->assertDefaultSearch(FALSE);
diff --git a/core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php b/core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php
index eff749805a51..5cd9fa8f7d2a 100644
--- a/core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php
+++ b/core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php
@@ -88,7 +88,7 @@ protected function setUp() {
     ])->save();
 
     // Create a test user to use as the entity owner.
-    $this->user = \Drupal::entityManager()->getStorage('user')->create([
+    $this->user = \Drupal::entityTypeManager()->getStorage('user')->create([
       'name' => 'serialization_test_user',
       'mail' => 'foo@example.com',
       'pass' => '123456',
diff --git a/core/modules/shortcut/shortcut.api.php b/core/modules/shortcut/shortcut.api.php
index c60e4567310e..c5c609c38f54 100644
--- a/core/modules/shortcut/shortcut.api.php
+++ b/core/modules/shortcut/shortcut.api.php
@@ -32,7 +32,7 @@
  */
 function hook_shortcut_default_set($account) {
   // Use a special set of default shortcuts for administrators only.
-  $roles = \Drupal::entityManager()->getStorage('user_role')->loadByProperties(['is_admin' => TRUE]);
+  $roles = \Drupal::entityTypeManager()->getStorage('user_role')->loadByProperties(['is_admin' => TRUE]);
   $user_admin_roles = array_intersect(array_keys($roles), $account->getRoles());
   if ($user_admin_roles) {
     return 'admin-shortcuts';
diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module
index 3941eb3621da..1b281b2b02b1 100644
--- a/core/modules/shortcut/shortcut.module
+++ b/core/modules/shortcut/shortcut.module
@@ -123,10 +123,10 @@ function shortcut_set_switch_access($account = NULL) {
  *   A user account that will be assigned to use the set.
  *
  * @deprecated in Drupal 8.x, will be removed before Drupal 9.0.
- *   Use \Drupal::entityManager()->getStorage('shortcut_set')->assignUser().
+ *   Use \Drupal::entityTypeManager()->getStorage('shortcut_set')->assignUser().
  */
 function shortcut_set_assign_user($shortcut_set, $account) {
-  \Drupal::entityManager()
+  \Drupal::entityTypeManager()
     ->getStorage('shortcut_set')
     ->assignUser($shortcut_set, $account);
 }
@@ -145,10 +145,10 @@ function shortcut_set_assign_user($shortcut_set, $account) {
  *   to any set.
  *
  * @deprecated in Drupal 8.x, will be removed before Drupal 9.0.
- *   Use \Drupal::entityManager()->getStorage('shortcut_set')->unassignUser().
+ *   Use \Drupal::entityTypeManager()->getStorage('shortcut_set')->unassignUser().
  */
 function shortcut_set_unassign_user($account) {
-  return (bool) \Drupal::entityManager()
+  return (bool) \Drupal::entityTypeManager()
     ->getStorage('shortcut_set')
     ->unassignUser($account);
 }
@@ -177,7 +177,7 @@ function shortcut_current_displayed_set($account = NULL) {
   }
   // If none was found, try to find a shortcut set that is explicitly assigned
   // to this user.
-  $shortcut_set_name = \Drupal::entityManager()
+  $shortcut_set_name = \Drupal::entityTypeManager()
     ->getStorage('shortcut_set')
     ->getAssignedToUser($account);
   if ($shortcut_set_name) {
@@ -325,7 +325,7 @@ function shortcut_preprocess_page_title(&$variables) {
     $shortcut_set = shortcut_current_displayed_set();
 
     // Check if $link is already a shortcut and set $link_mode accordingly.
-    $shortcuts = \Drupal::entityManager()->getStorage('shortcut')->loadByProperties(['shortcut_set' => $shortcut_set->id()]);
+    $shortcuts = \Drupal::entityTypeManager()->getStorage('shortcut')->loadByProperties(['shortcut_set' => $shortcut_set->id()]);
     /** @var \Drupal\shortcut\ShortcutInterface $shortcut */
     foreach ($shortcuts as $shortcut) {
       if (($shortcut_url = $shortcut->getUrl()) && $shortcut_url->isRouted() && $shortcut_url->getRouteName() == $route_match->getRouteName() && $shortcut_url->getRouteParameters() == $route_match->getRawParameters()->all()) {
diff --git a/core/modules/shortcut/src/Entity/ShortcutSet.php b/core/modules/shortcut/src/Entity/ShortcutSet.php
index 819f6475dd53..fba28ac41e1c 100644
--- a/core/modules/shortcut/src/Entity/ShortcutSet.php
+++ b/core/modules/shortcut/src/Entity/ShortcutSet.php
@@ -100,7 +100,7 @@ public static function preDelete(EntityStorageInterface $storage, array $entitie
         ->condition('shortcut_set', $entity->id(), '=')
         ->execute();
 
-      $controller = \Drupal::entityManager()->getStorage('shortcut');
+      $controller = \Drupal::entityTypeManager()->getStorage('shortcut');
       $entities = $controller->loadMultiple($shortcut_ids);
       $controller->delete($entities);
     }
@@ -123,7 +123,7 @@ public function resetLinkWeights() {
    * {@inheritdoc}
    */
   public function getShortcuts() {
-    $shortcuts = \Drupal::entityManager()->getStorage('shortcut')->loadByProperties(['shortcut_set' => $this->id()]);
+    $shortcuts = \Drupal::entityTypeManager()->getStorage('shortcut')->loadByProperties(['shortcut_set' => $this->id()]);
     uasort($shortcuts, ['\Drupal\shortcut\Entity\Shortcut', 'sort']);
     return $shortcuts;
   }
diff --git a/core/modules/shortcut/src/Tests/ShortcutTestBase.php b/core/modules/shortcut/src/Tests/ShortcutTestBase.php
index 584a6154c309..6f89201937e9 100644
--- a/core/modules/shortcut/src/Tests/ShortcutTestBase.php
+++ b/core/modules/shortcut/src/Tests/ShortcutTestBase.php
@@ -94,7 +94,7 @@ protected function setUp() {
     // Log in as admin and grab the default shortcut set.
     $this->drupalLogin($this->adminUser);
     $this->set = ShortcutSet::load('default');
-    \Drupal::entityManager()->getStorage('shortcut_set')->assignUser($this->set, $this->adminUser);
+    \Drupal::entityTypeManager()->getStorage('shortcut_set')->assignUser($this->set, $this->adminUser);
   }
 
   /**
@@ -125,7 +125,7 @@ public function generateShortcutSet($label = '', $id = NULL) {
    */
   public function getShortcutInformation(ShortcutSetInterface $set, $key) {
     $info = [];
-    \Drupal::entityManager()->getStorage('shortcut')->resetCache();
+    \Drupal::entityTypeManager()->getStorage('shortcut')->resetCache();
     foreach ($set->getShortcuts() as $shortcut) {
       if ($key == 'link') {
         $info[] = $shortcut->link->uri;
diff --git a/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php b/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php
index b897df752db8..636813cc8f57 100644
--- a/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php
+++ b/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php
@@ -91,7 +91,7 @@ public function testShortcutSetEdit() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     $this->assertRaw(t('The shortcut set has been updated.'));
 
-    \Drupal::entityManager()->getStorage('shortcut')->resetCache();
+    \Drupal::entityTypeManager()->getStorage('shortcut')->resetCache();
     // Check to ensure that the shortcut weights have changed and that
     // ShortcutSet::.getShortcuts() returns shortcuts in the new order.
     $this->assertIdentical(array_reverse(array_keys($shortcuts)), array_keys($set->getShortcuts()));
@@ -117,7 +117,7 @@ public function testShortcutSetSwitchOwn() {
   public function testShortcutSetAssign() {
     $new_set = $this->generateShortcutSet($this->randomMachineName());
 
-    \Drupal::entityManager()->getStorage('shortcut_set')->assignUser($new_set, $this->shortcutUser);
+    \Drupal::entityTypeManager()->getStorage('shortcut_set')->assignUser($new_set, $this->shortcutUser);
     $current_set = shortcut_current_displayed_set($this->shortcutUser);
     $this->assertTrue($new_set->id() == $current_set->id(), "Successfully switched another user's shortcut set.");
   }
@@ -169,7 +169,7 @@ public function testShortcutSetRename() {
   public function testShortcutSetUnassign() {
     $new_set = $this->generateShortcutSet($this->randomMachineName());
 
-    $shortcut_set_storage = \Drupal::entityManager()->getStorage('shortcut_set');
+    $shortcut_set_storage = \Drupal::entityTypeManager()->getStorage('shortcut_set');
     $shortcut_set_storage->assignUser($new_set, $this->shortcutUser);
     $shortcut_set_storage->unassignUser($this->shortcutUser);
     $current_set = shortcut_current_displayed_set($this->shortcutUser);
diff --git a/core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php b/core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php
index 3f9cc87be384..c11c418ae9a3 100644
--- a/core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php
+++ b/core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php
@@ -87,7 +87,7 @@ protected function setUp() {
     // Log in as admin and grab the default shortcut set.
     $this->drupalLogin($this->adminUser);
     $this->set = ShortcutSet::load('default');
-    \Drupal::entityManager()->getStorage('shortcut_set')->assignUser($this->set, $this->adminUser);
+    \Drupal::entityTypeManager()->getStorage('shortcut_set')->assignUser($this->set, $this->adminUser);
   }
 
   /**
@@ -118,7 +118,7 @@ public function generateShortcutSet($label = '', $id = NULL) {
    */
   public function getShortcutInformation(ShortcutSetInterface $set, $key) {
     $info = [];
-    \Drupal::entityManager()->getStorage('shortcut')->resetCache();
+    \Drupal::entityTypeManager()->getStorage('shortcut')->resetCache();
     foreach ($set->getShortcuts() as $shortcut) {
       if ($key == 'link') {
         $info[] = $shortcut->link->uri;
diff --git a/core/modules/simpletest/src/Tests/KernelTestBaseTest.php b/core/modules/simpletest/src/Tests/KernelTestBaseTest.php
index c92381fab8dc..d34ff91e6e16 100644
--- a/core/modules/simpletest/src/Tests/KernelTestBaseTest.php
+++ b/core/modules/simpletest/src/Tests/KernelTestBaseTest.php
@@ -240,7 +240,7 @@ public function testInstallConfig() {
   public function testEnableModulesFixedList() {
     // Install system module.
     $this->container->get('module_installer')->install(['system', 'user', 'menu_link_content']);
-    $entity_manager = \Drupal::entityManager();
+    $entity_manager = \Drupal::entityTypeManager();
 
     // entity_test is loaded via $modules; its entity type should exist.
     $this->assertEqual($this->container->get('module_handler')->moduleExists('entity_test'), TRUE);
diff --git a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php
index 6b3e3c4ab125..2aa64e86940b 100644
--- a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php
+++ b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php
@@ -210,7 +210,7 @@ protected function getAdditionalCacheTagsForEntityListing() {
    * chooses 'default'.
    */
   protected function selectViewMode($entity_type) {
-    $view_modes = \Drupal::entityManager()
+    $view_modes = \Drupal::entityTypeManager()
       ->getStorage('entity_view_mode')
       ->loadByProperties(['targetEntityType' => $entity_type]);
 
@@ -295,7 +295,7 @@ protected function createReferenceTestEntities($referenced_entity) {
     }
 
     // Create an entity that does reference the entity being tested.
-    $label_key = \Drupal::entityManager()->getDefinition($entity_type)->getKey('label');
+    $label_key = \Drupal::entityTypeManager()->getDefinition($entity_type)->getKey('label');
     $referencing_entity = $this->container->get('entity_type.manager')
       ->getStorage($entity_type)
       ->create([
@@ -362,7 +362,7 @@ public function testReferencedEntity() {
 
     $view_cache_tag = [];
     if ($this->entity->getEntityType()->hasHandlerClass('view_builder')) {
-      $view_cache_tag = \Drupal::entityManager()->getViewBuilder($entity_type)
+      $view_cache_tag = \Drupal::entityTypeManager()->getViewBuilder($entity_type)
         ->getCacheTags();
     }
 
@@ -370,7 +370,7 @@ public function testReferencedEntity() {
     $cache_context_tags = $context_metadata->getCacheTags();
 
     // Generate the cache tags for the (non) referencing entities.
-    $referencing_entity_cache_tags = Cache::mergeTags($this->referencingEntity->getCacheTags(), \Drupal::entityManager()->getViewBuilder('entity_test')->getCacheTags());
+    $referencing_entity_cache_tags = Cache::mergeTags($this->referencingEntity->getCacheTags(), \Drupal::entityTypeManager()->getViewBuilder('entity_test')->getCacheTags());
     // Includes the main entity's cache tags, since this entity references it.
     $referencing_entity_cache_tags = Cache::mergeTags($referencing_entity_cache_tags, $this->entity->getCacheTags());
     $referencing_entity_cache_tags = Cache::mergeTags($referencing_entity_cache_tags, $this->getAdditionalCacheTagsForEntity($this->entity));
@@ -378,7 +378,7 @@ public function testReferencedEntity() {
     $referencing_entity_cache_tags = Cache::mergeTags($referencing_entity_cache_tags, $cache_context_tags);
     $referencing_entity_cache_tags = Cache::mergeTags($referencing_entity_cache_tags, ['rendered']);
 
-    $non_referencing_entity_cache_tags = Cache::mergeTags($this->nonReferencingEntity->getCacheTags(), \Drupal::entityManager()->getViewBuilder('entity_test')->getCacheTags());
+    $non_referencing_entity_cache_tags = Cache::mergeTags($this->nonReferencingEntity->getCacheTags(), \Drupal::entityTypeManager()->getViewBuilder('entity_test')->getCacheTags());
     $non_referencing_entity_cache_tags = Cache::mergeTags($non_referencing_entity_cache_tags, ['rendered']);
 
     // Generate the cache tags for all two possible entity listing paths.
@@ -640,7 +640,7 @@ public function testReferencedEntity() {
     $this->verifyPageCache($non_referencing_entity_url, 'HIT');
 
     // Verify cache hits.
-    $referencing_entity_cache_tags = Cache::mergeTags($this->referencingEntity->getCacheTags(), \Drupal::entityManager()->getViewBuilder('entity_test')->getCacheTags());
+    $referencing_entity_cache_tags = Cache::mergeTags($this->referencingEntity->getCacheTags(), \Drupal::entityTypeManager()->getViewBuilder('entity_test')->getCacheTags());
     $referencing_entity_cache_tags = Cache::mergeTags($referencing_entity_cache_tags, ['http_response', 'rendered']);
 
     $nonempty_entity_listing_cache_tags = Cache::mergeTags($this->entity->getEntityType()->getListCacheTags(), $this->getAdditionalCacheTagsForEntityListing());
diff --git a/core/modules/system/src/Tests/Entity/EntityWithUriCacheTagsTestBase.php b/core/modules/system/src/Tests/Entity/EntityWithUriCacheTagsTestBase.php
index a3006b498b4f..1e2fb6145dba 100644
--- a/core/modules/system/src/Tests/Entity/EntityWithUriCacheTagsTestBase.php
+++ b/core/modules/system/src/Tests/Entity/EntityWithUriCacheTagsTestBase.php
@@ -38,7 +38,7 @@ public function testEntityUri() {
 
     // Generate the standardized entity cache tags.
     $cache_tag = $this->entity->getCacheTags();
-    $view_cache_tag = \Drupal::entityManager()->getViewBuilder($entity_type)->getCacheTags();
+    $view_cache_tag = \Drupal::entityTypeManager()->getViewBuilder($entity_type)->getCacheTags();
     $render_cache_tag = 'rendered';
 
     $this->pass("Test entity.", 'Debug');
@@ -49,7 +49,7 @@ public function testEntityUri() {
 
     // Also verify the existence of an entity render cache entry, if this entity
     // type supports render caching.
-    if (\Drupal::entityManager()->getDefinition($entity_type)->isRenderCacheable()) {
+    if (\Drupal::entityTypeManager()->getDefinition($entity_type)->isRenderCacheable()) {
       $cache_keys = ['entity_view', $entity_type, $this->entity->id(), $view_mode];
       $cid = $this->createCacheId($cache_keys, $entity_cache_contexts);
       $redirected_cid = NULL;
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index ceff294c9ceb..b7f99d9bf983 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -762,7 +762,7 @@ function system_requirements($phase) {
     if ($change_list = \Drupal::entityDefinitionUpdateManager()->getChangeSummary()) {
       $build = [];
       foreach ($change_list as $entity_type_id => $changes) {
-        $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id);
+        $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id);
         $build[] = [
           '#theme' => 'item_list',
           '#title' => $entity_type->getLabel(),
@@ -1330,7 +1330,7 @@ function system_update_8004() {
   // https://www.drupal.org/node/2542748. Regenerate the related schemas to
   // ensure they match the currently expected status.
   $manager = \Drupal::entityDefinitionUpdateManager();
-  foreach (array_keys(\Drupal::entityManager()
+  foreach (array_keys(\Drupal::entityTypeManager()
     ->getDefinitions()) as $entity_type_id) {
     // Only update the entity type if it already exists. This condition is
     // needed in case new entity types are introduced after this update.
@@ -1591,7 +1591,7 @@ function _system_update_create_block($name, $theme_name, array $values) {
 function system_update_8007() {
   $database = \Drupal::database();
   $database_schema = $database->schema();
-  $entity_types = \Drupal::entityManager()->getDefinitions();
+  $entity_types = \Drupal::entityTypeManager()->getDefinitions();
 
   $schema = \Drupal::keyValue('entity.storage_schema.sql')->getAll();
   $schema_copy = $schema;
@@ -1649,7 +1649,7 @@ function system_update_8007() {
  * Purge field schema data for uninstalled entity types.
  */
 function system_update_8008() {
-  $entity_types = \Drupal::entityManager()->getDefinitions();
+  $entity_types = \Drupal::entityTypeManager()->getDefinitions();
   /** @var \Drupal\Core\KeyValueStore\KeyValueStoreInterface $schema */
   $schema = \Drupal::keyValue('entity.storage_schema.sql');
   foreach ($schema->getAll() as $key => $item) {
diff --git a/core/modules/system/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module
index 0ee7e35b871b..9a080bfa3b6c 100644
--- a/core/modules/system/tests/modules/entity_test/entity_test.module
+++ b/core/modules/system/tests/modules/entity_test/entity_test.module
@@ -221,7 +221,7 @@ function entity_test_delete_bundle($bundle, $entity_type = 'entity_test') {
  */
 function entity_test_entity_bundle_info() {
   $bundles = [];
-  $entity_types = \Drupal::entityManager()->getDefinitions();
+  $entity_types = \Drupal::entityTypeManager()->getDefinitions();
   foreach ($entity_types as $entity_type_id => $entity_type) {
     if ($entity_type->getProvider() == 'entity_test' && $entity_type_id != 'entity_test_with_bundle') {
       $bundles[$entity_type_id] = \Drupal::state()->get($entity_type_id . '.bundles') ?: [$entity_type_id => ['label' => 'Entity Test Bundle']];
@@ -254,7 +254,7 @@ function entity_test_entity_bundle_info_alter(&$bundles) {
  * Implements hook_entity_view_mode_info_alter().
  */
 function entity_test_entity_view_mode_info_alter(&$view_modes) {
-  $entity_info = \Drupal::entityManager()->getDefinitions();
+  $entity_info = \Drupal::entityTypeManager()->getDefinitions();
   foreach ($entity_info as $entity_type => $info) {
     if ($entity_info[$entity_type]->getProvider() == 'entity_test' && !isset($view_modes[$entity_type])) {
       $view_modes[$entity_type] = [
@@ -277,7 +277,7 @@ function entity_test_entity_view_mode_info_alter(&$view_modes) {
  * Implements hook_entity_form_mode_info_alter().
  */
 function entity_test_entity_form_mode_info_alter(&$form_modes) {
-  $entity_info = \Drupal::entityManager()->getDefinitions();
+  $entity_info = \Drupal::entityTypeManager()->getDefinitions();
   foreach ($entity_info as $entity_type => $info) {
     if ($entity_info[$entity_type]->getProvider() == 'entity_test') {
       $form_modes[$entity_type] = [
diff --git a/core/modules/system/tests/src/Functional/Datetime/DrupalDateTimeTest.php b/core/modules/system/tests/src/Functional/Datetime/DrupalDateTimeTest.php
index 488fa6ef42eb..6843e54f7537 100644
--- a/core/modules/system/tests/src/Functional/Datetime/DrupalDateTimeTest.php
+++ b/core/modules/system/tests/src/Functional/Datetime/DrupalDateTimeTest.php
@@ -88,7 +88,7 @@ public function testDateTimezone() {
     $this->drupalPostForm('user/' . $test_user->id() . '/edit', $edit, t('Save'));
 
     // Reload the user and reset the timezone in AccountProxy::setAccount().
-    \Drupal::entityManager()->getStorage('user')->resetCache();
+    \Drupal::entityTypeManager()->getStorage('user')->resetCache();
     $this->container->get('current_user')->setAccount(User::load($test_user->id()));
 
     // Create a date object with an unspecified timezone, which should
diff --git a/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php b/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php
index 453af58fd598..e92b64700167 100644
--- a/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php
+++ b/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php
@@ -203,7 +203,7 @@ protected function getAdditionalCacheTagsForEntityListing() {
    * chooses 'default'.
    */
   protected function selectViewMode($entity_type) {
-    $view_modes = \Drupal::entityManager()
+    $view_modes = \Drupal::entityTypeManager()
       ->getStorage('entity_view_mode')
       ->loadByProperties(['targetEntityType' => $entity_type]);
 
@@ -287,7 +287,7 @@ protected function createReferenceTestEntities($referenced_entity) {
     }
 
     // Create an entity that does reference the entity being tested.
-    $label_key = \Drupal::entityManager()->getDefinition($entity_type)->getKey('label');
+    $label_key = \Drupal::entityTypeManager()->getDefinition($entity_type)->getKey('label');
     $referencing_entity = $this->container->get('entity_type.manager')
       ->getStorage($entity_type)
       ->create([
@@ -354,7 +354,7 @@ public function testReferencedEntity() {
 
     $view_cache_tag = [];
     if ($this->entity->getEntityType()->hasHandlerClass('view_builder')) {
-      $view_cache_tag = \Drupal::entityManager()->getViewBuilder($entity_type)
+      $view_cache_tag = \Drupal::entityTypeManager()->getViewBuilder($entity_type)
         ->getCacheTags();
     }
 
@@ -362,7 +362,7 @@ public function testReferencedEntity() {
     $cache_context_tags = $context_metadata->getCacheTags();
 
     // Generate the cache tags for the (non) referencing entities.
-    $referencing_entity_cache_tags = Cache::mergeTags($this->referencingEntity->getCacheTags(), \Drupal::entityManager()->getViewBuilder('entity_test')->getCacheTags());
+    $referencing_entity_cache_tags = Cache::mergeTags($this->referencingEntity->getCacheTags(), \Drupal::entityTypeManager()->getViewBuilder('entity_test')->getCacheTags());
     // Includes the main entity's cache tags, since this entity references it.
     $referencing_entity_cache_tags = Cache::mergeTags($referencing_entity_cache_tags, $this->entity->getCacheTags());
     $referencing_entity_cache_tags = Cache::mergeTags($referencing_entity_cache_tags, $this->getAdditionalCacheTagsForEntity($this->entity));
@@ -370,7 +370,7 @@ public function testReferencedEntity() {
     $referencing_entity_cache_tags = Cache::mergeTags($referencing_entity_cache_tags, $cache_context_tags);
     $referencing_entity_cache_tags = Cache::mergeTags($referencing_entity_cache_tags, ['rendered']);
 
-    $non_referencing_entity_cache_tags = Cache::mergeTags($this->nonReferencingEntity->getCacheTags(), \Drupal::entityManager()->getViewBuilder('entity_test')->getCacheTags());
+    $non_referencing_entity_cache_tags = Cache::mergeTags($this->nonReferencingEntity->getCacheTags(), \Drupal::entityTypeManager()->getViewBuilder('entity_test')->getCacheTags());
     $non_referencing_entity_cache_tags = Cache::mergeTags($non_referencing_entity_cache_tags, ['rendered']);
 
     // Generate the cache tags for all two possible entity listing paths.
@@ -633,7 +633,7 @@ public function testReferencedEntity() {
     $this->verifyPageCache($non_referencing_entity_url, 'HIT');
 
     // Verify cache hits.
-    $referencing_entity_cache_tags = Cache::mergeTags($this->referencingEntity->getCacheTags(), \Drupal::entityManager()->getViewBuilder('entity_test')->getCacheTags());
+    $referencing_entity_cache_tags = Cache::mergeTags($this->referencingEntity->getCacheTags(), \Drupal::entityTypeManager()->getViewBuilder('entity_test')->getCacheTags());
     $referencing_entity_cache_tags = Cache::mergeTags($referencing_entity_cache_tags, ['http_response', 'rendered']);
 
     $nonempty_entity_listing_cache_tags = Cache::mergeTags($this->entity->getEntityType()->getListCacheTags(), $this->getAdditionalCacheTagsForEntityListing());
diff --git a/core/modules/system/tests/src/Functional/Entity/EntityWithUriCacheTagsTestBase.php b/core/modules/system/tests/src/Functional/Entity/EntityWithUriCacheTagsTestBase.php
index a102e6f7940a..e62d343ced93 100644
--- a/core/modules/system/tests/src/Functional/Entity/EntityWithUriCacheTagsTestBase.php
+++ b/core/modules/system/tests/src/Functional/Entity/EntityWithUriCacheTagsTestBase.php
@@ -31,7 +31,7 @@ public function testEntityUri() {
 
     // Generate the standardized entity cache tags.
     $cache_tag = $this->entity->getCacheTags();
-    $view_cache_tag = \Drupal::entityManager()->getViewBuilder($entity_type)->getCacheTags();
+    $view_cache_tag = \Drupal::entityTypeManager()->getViewBuilder($entity_type)->getCacheTags();
     $render_cache_tag = 'rendered';
 
     $this->pass("Test entity.", 'Debug');
@@ -42,7 +42,7 @@ public function testEntityUri() {
 
     // Also verify the existence of an entity render cache entry, if this entity
     // type supports render caching.
-    if (\Drupal::entityManager()->getDefinition($entity_type)->isRenderCacheable()) {
+    if (\Drupal::entityTypeManager()->getDefinition($entity_type)->isRenderCacheable()) {
       $cache_keys = ['entity_view', $entity_type, $this->entity->id(), $view_mode];
       $cid = $this->createCacheId($cache_keys, $entity_cache_contexts);
       $redirected_cid = NULL;
diff --git a/core/modules/system/tests/src/Functional/Entity/Update/SqlContentEntityStorageSchemaConverterTestBase.php b/core/modules/system/tests/src/Functional/Entity/Update/SqlContentEntityStorageSchemaConverterTestBase.php
index 05876bff62f0..33f2ca5cd187 100644
--- a/core/modules/system/tests/src/Functional/Entity/Update/SqlContentEntityStorageSchemaConverterTestBase.php
+++ b/core/modules/system/tests/src/Functional/Entity/Update/SqlContentEntityStorageSchemaConverterTestBase.php
@@ -14,13 +14,6 @@ abstract class SqlContentEntityStorageSchemaConverterTestBase extends UpdatePath
   use EntityDefinitionTestTrait;
   use ExpectDeprecationTrait;
 
-  /**
-   * The entity manager service.
-   *
-   * @var \Drupal\Core\Entity\EntityManagerInterface
-   */
-  protected $entityManager;
-
   /**
    * The entity definition update manager.
    *
@@ -55,7 +48,6 @@ abstract class SqlContentEntityStorageSchemaConverterTestBase extends UpdatePath
   protected function setUp() {
     parent::setUp();
 
-    $this->entityManager = \Drupal::entityManager();
     $this->entityDefinitionUpdateManager = \Drupal::entityDefinitionUpdateManager();
     $this->lastInstalledSchemaRepository = \Drupal::service('entity.last_installed_schema.repository');
     $this->installedStorageSchema = \Drupal::keyValue('entity.storage_schema.sql');
diff --git a/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php b/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php
index 1a49336777ed..fc6e8c1ac09d 100644
--- a/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php
+++ b/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php
@@ -176,7 +176,7 @@ public function testPluginLocalTask() {
 
     // Test that we we correctly apply the active class to tabs where one of the
     // request attributes is upcast to an entity object.
-    $entity = \Drupal::entityManager()->getStorage('entity_test')->create(['bundle' => 'test']);
+    $entity = \Drupal::entityTypeManager()->getStorage('entity_test')->create(['bundle' => 'test']);
     $entity->save();
 
     $this->drupalGet(Url::fromRoute('menu_test.local_task_test_upcasting_sub1', ['entity_test' => '1']));
diff --git a/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php b/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php
index d1f6be457f0d..bcdf8ea33df9 100644
--- a/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php
+++ b/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php
@@ -352,7 +352,7 @@ protected function preUninstallForum() {
     $query = \Drupal::entityQuery('taxonomy_term');
     $query->condition('vid', 'forums');
     $ids = $query->execute();
-    $storage = \Drupal::entityManager()->getStorage('taxonomy_term');
+    $storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term');
     $terms = $storage->loadMultiple($ids);
     $storage->delete($terms);
   }
diff --git a/core/modules/system/tests/src/Functional/Module/UninstallTest.php b/core/modules/system/tests/src/Functional/Module/UninstallTest.php
index 98b96ee91ef1..d061646f7e9a 100644
--- a/core/modules/system/tests/src/Functional/Module/UninstallTest.php
+++ b/core/modules/system/tests/src/Functional/Module/UninstallTest.php
@@ -104,7 +104,7 @@ public function testUninstallPage() {
     }
     $entity_types = array_unique($entity_types);
     foreach ($entity_types as $entity_type_id) {
-      $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id);
+      $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id);
       // Add h3's since the entity type label is often repeated in the entity
       // labels.
       $this->assertRaw('<h3>' . $entity_type->getLabel() . '</h3>');
diff --git a/core/modules/system/tests/src/Functional/System/DateTimeTest.php b/core/modules/system/tests/src/Functional/System/DateTimeTest.php
index 15f3608885bb..0a365a7a7dab 100644
--- a/core/modules/system/tests/src/Functional/System/DateTimeTest.php
+++ b/core/modules/system/tests/src/Functional/System/DateTimeTest.php
@@ -64,7 +64,7 @@ public function testTimeZoneHandling() {
 
     // Set time zone to Los Angeles time.
     $config->set('timezone.default', 'America/Los_Angeles')->save();
-    \Drupal::entityManager()->getViewBuilder('node')->resetCache([$node1, $node2]);
+    \Drupal::entityTypeManager()->getViewBuilder('node')->resetCache([$node1, $node2]);
 
     // Confirm date format and time zone.
     $this->drupalGet('node/' . $node1->id());
diff --git a/core/modules/system/tests/src/Functional/Update/LocalActionsAndTasksConvertedIntoBlocksUpdateTest.php b/core/modules/system/tests/src/Functional/Update/LocalActionsAndTasksConvertedIntoBlocksUpdateTest.php
index cfa822104084..ff4075e9e693 100644
--- a/core/modules/system/tests/src/Functional/Update/LocalActionsAndTasksConvertedIntoBlocksUpdateTest.php
+++ b/core/modules/system/tests/src/Functional/Update/LocalActionsAndTasksConvertedIntoBlocksUpdateTest.php
@@ -42,7 +42,7 @@ public function testUpdateHookN() {
     $this->runUpdates();
 
     /** @var \Drupal\block\BlockInterface $block_storage */
-    $block_storage = \Drupal::entityManager()->getStorage('block');
+    $block_storage = \Drupal::entityTypeManager()->getStorage('block');
     /* @var \Drupal\block\BlockInterface[] $help_blocks */
     $help_blocks = $block_storage->loadByProperties(['theme' => 'bartik', 'region' => 'help']);
 
diff --git a/core/modules/system/tests/src/Functional/Update/PageTitleConvertedIntoBlockUpdateTest.php b/core/modules/system/tests/src/Functional/Update/PageTitleConvertedIntoBlockUpdateTest.php
index c9c264c96b5c..6e17506220d0 100644
--- a/core/modules/system/tests/src/Functional/Update/PageTitleConvertedIntoBlockUpdateTest.php
+++ b/core/modules/system/tests/src/Functional/Update/PageTitleConvertedIntoBlockUpdateTest.php
@@ -43,7 +43,7 @@ public function testUpdateHookN() {
     $this->runUpdates();
 
     /** @var \Drupal\block\BlockInterface $block_storage */
-    $block_storage = \Drupal::entityManager()->getStorage('block');
+    $block_storage = \Drupal::entityTypeManager()->getStorage('block');
 
     $this->assertRaw('Because your site has custom theme(s) installed, we have placed the page title block in the content region. Please manually review the block configuration and remove the page title variables from your page templates.');
 
diff --git a/core/modules/system/tests/src/Functional/Update/SevenSecondaryLocalTasksConvertedIntoBlockUpdateTest.php b/core/modules/system/tests/src/Functional/Update/SevenSecondaryLocalTasksConvertedIntoBlockUpdateTest.php
index 172897497d3f..b0a58623a546 100644
--- a/core/modules/system/tests/src/Functional/Update/SevenSecondaryLocalTasksConvertedIntoBlockUpdateTest.php
+++ b/core/modules/system/tests/src/Functional/Update/SevenSecondaryLocalTasksConvertedIntoBlockUpdateTest.php
@@ -41,7 +41,7 @@ public function testUpdateHookN() {
     $this->runUpdates();
 
     /** @var \Drupal\block\BlockInterface $block_storage */
-    $block_storage = \Drupal::entityManager()->getStorage('block');
+    $block_storage = \Drupal::entityTypeManager()->getStorage('block');
 
     // Disable maintenance mode.
     // @todo Can be removed once maintenance mode is automatically turned off
diff --git a/core/modules/system/tests/src/Functional/Update/SiteBrandingConvertedIntoBlockUpdateTest.php b/core/modules/system/tests/src/Functional/Update/SiteBrandingConvertedIntoBlockUpdateTest.php
index 72f3a2782469..56b988e956d2 100644
--- a/core/modules/system/tests/src/Functional/Update/SiteBrandingConvertedIntoBlockUpdateTest.php
+++ b/core/modules/system/tests/src/Functional/Update/SiteBrandingConvertedIntoBlockUpdateTest.php
@@ -39,7 +39,7 @@ public function testUpdateHookN() {
     $this->runUpdates();
 
     /** @var \Drupal\block\BlockInterface $block_storage */
-    $block_storage = \Drupal::entityManager()->getStorage('block');
+    $block_storage = \Drupal::entityTypeManager()->getStorage('block');
 
     $this->assertRaw('Because your site has custom theme(s) installed, we had to set the branding block into the content region. Please manually review the block configuration and remove the site name, slogan, and logo variables from your templates.');
 
diff --git a/core/modules/system/tests/src/Functional/Update/UpdatePathRC1TestBaseTest.php b/core/modules/system/tests/src/Functional/Update/UpdatePathRC1TestBaseTest.php
index da53ba6e6308..af2552492aa4 100644
--- a/core/modules/system/tests/src/Functional/Update/UpdatePathRC1TestBaseTest.php
+++ b/core/modules/system/tests/src/Functional/Update/UpdatePathRC1TestBaseTest.php
@@ -62,7 +62,7 @@ public function testDatabaseLoaded() {
     $this->assertText('Site-Install');
     $extensions = \Drupal::service('config.storage')->read('core.extension');
     $this->assertTrue(isset($extensions['theme']['stable']), 'Stable is installed after updating.');
-    $blocks = \Drupal::entityManager()->getStorage('block')->loadByProperties(['theme' => 'stable']);
+    $blocks = \Drupal::entityTypeManager()->getStorage('block')->loadByProperties(['theme' => 'stable']);
     $this->assertTrue(empty($blocks), 'No blocks have been placed for Stable.');
   }
 
diff --git a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
index 976032e05069..63229a913980 100644
--- a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
+++ b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
@@ -269,7 +269,7 @@ public function testUninstallContentDependency() {
     $this->assertTrue($this->moduleHandler()->moduleExists('module_test'), 'Test module is enabled.');
 
     $this->installSchema('user', 'users_data');
-    $entity_types = \Drupal::entityManager()->getDefinitions();
+    $entity_types = \Drupal::entityTypeManager()->getDefinitions();
     foreach ($entity_types as $entity_type) {
       if ('entity_test' == $entity_type->getProvider()) {
         $this->installEntitySchema($entity_type->id());
diff --git a/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php b/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php
index 785629e1fe5a..7dda500d7c9c 100644
--- a/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php
+++ b/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php
@@ -139,7 +139,7 @@ public function preRender(&$values) {
       if (empty($this->options['limit'])) {
         $vocabs = [];
       }
-      $result = \Drupal::entityManager()->getStorage('taxonomy_term')->getNodeTerms($nids, $vocabs);
+      $result = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->getNodeTerms($nids, $vocabs);
 
       foreach ($result as $node_nid => $data) {
         foreach ($data as $tid => $term) {
diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index 4ba6d195ad78..160bcbe635c4 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -289,7 +289,7 @@ function taxonomy_term_is_page(Term $term) {
  * Clear all static cache variables for terms.
  */
 function taxonomy_terms_static_reset() {
-  \Drupal::entityManager()->getStorage('taxonomy_term')->resetCache();
+  \Drupal::entityTypeManager()->getStorage('taxonomy_term')->resetCache();
 }
 
 /**
@@ -299,7 +299,7 @@ function taxonomy_terms_static_reset() {
  *   An array of ids to reset in the entity cache.
  */
 function taxonomy_vocabulary_static_reset(array $ids = NULL) {
-  \Drupal::entityManager()->getStorage('taxonomy_vocabulary')->resetCache($ids);
+  \Drupal::entityTypeManager()->getStorage('taxonomy_vocabulary')->resetCache($ids);
 }
 
 /**
@@ -513,7 +513,7 @@ function taxonomy_node_insert(EntityInterface $node) {
 function taxonomy_build_node_index($node) {
   // We maintain a denormalized table of term/node relationships, containing
   // only data for current, published nodes.
-  if (!\Drupal::config('taxonomy.settings')->get('maintain_index_table') || !(\Drupal::entityManager()->getStorage('node') instanceof SqlContentEntityStorage)) {
+  if (!\Drupal::config('taxonomy.settings')->get('maintain_index_table') || !(\Drupal::entityTypeManager()->getStorage('node') instanceof SqlContentEntityStorage)) {
     return;
   }
 
diff --git a/core/modules/taxonomy/taxonomy.tokens.inc b/core/modules/taxonomy/taxonomy.tokens.inc
index b6931b7cbb08..39d7da5e14c8 100644
--- a/core/modules/taxonomy/taxonomy.tokens.inc
+++ b/core/modules/taxonomy/taxonomy.tokens.inc
@@ -95,7 +95,7 @@ function taxonomy_tokens($type, $tokens, array $data, array $options, Bubbleable
   $token_service = \Drupal::token();
 
   $replacements = [];
-  $taxonomy_storage = \Drupal::entityManager()->getStorage('taxonomy_term');
+  $taxonomy_storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term');
   if ($type == 'term' && !empty($data['term'])) {
     $term = $data['term'];
 
diff --git a/core/modules/taxonomy/tests/src/Functional/TaxonomyQueryAlterTest.php b/core/modules/taxonomy/tests/src/Functional/TaxonomyQueryAlterTest.php
index 0e2c5aa39932..ab708d40481e 100644
--- a/core/modules/taxonomy/tests/src/Functional/TaxonomyQueryAlterTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/TaxonomyQueryAlterTest.php
@@ -37,7 +37,7 @@ public function testTaxonomyQueryAlter() {
     $terms[2]->parent = $terms[1]->id();
     $terms[2]->save();
 
-    $term_storage = \Drupal::entityManager()->getStorage('taxonomy_term');
+    $term_storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term');
 
     $this->setupQueryTagTestHooks();
     $loaded_term = $term_storage->load($terms[0]->id());
diff --git a/core/modules/taxonomy/tests/src/Functional/TaxonomyTermIndentationTest.php b/core/modules/taxonomy/tests/src/Functional/TaxonomyTermIndentationTest.php
index c701dfeebaf5..eb57142c87e2 100644
--- a/core/modules/taxonomy/tests/src/Functional/TaxonomyTermIndentationTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/TaxonomyTermIndentationTest.php
@@ -87,7 +87,7 @@ public function testTermIndentation() {
     $this->assertSession()->responseNotMatches('|<div class="js-indentation indentation">&nbsp;</div>|');
 
     // Check explicitly that term 2 has no parents.
-    \Drupal::entityManager()->getStorage('taxonomy_term')->resetCache();
+    \Drupal::entityTypeManager()->getStorage('taxonomy_term')->resetCache();
     $parents = $taxonomy_storage->loadParents($term2->id());
     $this->assertTrue(empty($parents), 'Term 2 has no parents now');
   }
diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTest.php
index 20ecb6390346..6eb3ed1ea454 100644
--- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTest.php
@@ -96,7 +96,7 @@ public function testTaxonomyTerms() {
       }
       else {
         $parents = [];
-        foreach (\Drupal::entityManager()->getStorage('taxonomy_term')->loadParents($tid) as $parent) {
+        foreach (\Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadParents($tid) as $parent) {
           $parents[] = (int) $parent->id();
         }
         $this->assertSame($parents, $values['parent']);
diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php
index 25544486ab28..3fd755440aa1 100644
--- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php
@@ -31,7 +31,7 @@ protected function setUp() {
    * Tests the Drupal 6 term-node revision association to Drupal 8 migration.
    */
   public function testTermRevisionNode() {
-    $node = \Drupal::entityManager()->getStorage('node')->loadRevision(2001);
+    $node = \Drupal::entityTypeManager()->getStorage('node')->loadRevision(2001);
     $this->assertSame(2, count($node->field_vocabulary_3_i_2_));
     $this->assertSame('4', $node->field_vocabulary_3_i_2_[0]->target_id);
     $this->assertSame('5', $node->field_vocabulary_3_i_2_[1]->target_id);
diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php
index d735232a6780..b8b0169bbd0d 100644
--- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php
@@ -138,7 +138,7 @@ public function testTaxonomyTerms() {
    *   List of parent term IDs.
    */
   protected function getParentIDs($tid) {
-    return array_keys(\Drupal::entityManager()->getStorage('taxonomy_term')->loadParents($tid));
+    return array_keys(\Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadParents($tid));
   }
 
   /**
diff --git a/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php b/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php
index 4e1eaafa1e5b..c2d9d667c976 100644
--- a/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php
@@ -127,7 +127,7 @@ public function testTaxonomyVocabularyTree() {
     $this->assertEqual(1, $depth_count[3], 'One element in taxonomy tree depth 3.');
 
     /** @var \Drupal\taxonomy\TermStorageInterface $storage */
-    $storage = \Drupal::entityManager()->getStorage('taxonomy_term');
+    $storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term');
     // Count parents of $term[2].
     $parents = $storage->loadParents($term[2]->id());
     $this->assertEqual(2, count($parents), 'The term has two parents.');
diff --git a/core/modules/tracker/tracker.pages.inc b/core/modules/tracker/tracker.pages.inc
index 507f14b64efd..575c31bae069 100644
--- a/core/modules/tracker/tracker.pages.inc
+++ b/core/modules/tracker/tracker.pages.inc
@@ -124,7 +124,7 @@ function tracker_page($account = NULL) {
   }
 
   // Add the list cache tag for nodes.
-  $cache_tags = Cache::mergeTags($cache_tags, \Drupal::entityManager()->getDefinition('node')->getListCacheTags());
+  $cache_tags = Cache::mergeTags($cache_tags, \Drupal::entityTypeManager()->getDefinition('node')->getListCacheTags());
 
   $page['tracker'] = [
     '#rows' => $rows,
diff --git a/core/modules/user/src/Entity/User.php b/core/modules/user/src/Entity/User.php
index ebb11341282f..8ed8dfdac8c0 100644
--- a/core/modules/user/src/Entity/User.php
+++ b/core/modules/user/src/Entity/User.php
@@ -420,8 +420,8 @@ public static function getAnonymousUser() {
 
       // @todo Use the entity factory once available, see
       //   https://www.drupal.org/node/1867228.
-      $entity_manager = \Drupal::entityManager();
-      $entity_type = $entity_manager->getDefinition('user');
+      $entity_type_manager = \Drupal::entityTypeManager();
+      $entity_type = $entity_type_manager->getDefinition('user');
       $class = $entity_type->getClass();
 
       static::$anonymousUser = new $class([
@@ -557,7 +557,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    *   The role storage object.
    */
   protected function getRoleStorage() {
-    return \Drupal::entityManager()->getStorage('user_role');
+    return \Drupal::entityTypeManager()->getStorage('user_role');
   }
 
   /**
diff --git a/core/modules/user/tests/src/Functional/UserCancelTest.php b/core/modules/user/tests/src/Functional/UserCancelTest.php
index 968330c2a5e8..631b35183a7b 100644
--- a/core/modules/user/tests/src/Functional/UserCancelTest.php
+++ b/core/modules/user/tests/src/Functional/UserCancelTest.php
@@ -268,7 +268,7 @@ public function testUserBlockUnpublish() {
     $test_node = node_revision_load($node->getRevisionId());
     $this->assertFalse($test_node->isPublished(), 'Node revision of the user has been unpublished.');
 
-    $storage = \Drupal::entityManager()->getStorage('comment');
+    $storage = \Drupal::entityTypeManager()->getStorage('comment');
     $storage->resetCache([$comment->id()]);
     $comment = $storage->load($comment->id());
     $this->assertFalse($comment->isPublished(), 'Comment of the user has been unpublished.');
@@ -345,7 +345,7 @@ public function testUserAnonymize() {
     $test_node = $node_storage->load($revision_node->id());
     $this->assertTrue(($test_node->getOwnerId() != 0 && $test_node->isPublished()), "Current revision of the user's node was not attributed to anonymous user.");
 
-    $storage = \Drupal::entityManager()->getStorage('comment');
+    $storage = \Drupal::entityTypeManager()->getStorage('comment');
     $storage->resetCache([$comment->id()]);
     $test_comment = $storage->load($comment->id());
     $this->assertTrue(($test_comment->getOwnerId() == 0 && $test_comment->isPublished()), 'Comment of the user has been attributed to anonymous user.');
@@ -467,7 +467,7 @@ public function testUserDelete() {
     $this->assertFalse(node_revision_load($revision), 'Node revision of the user has been deleted.');
     $node_storage->resetCache([$revision_node->id()]);
     $this->assertTrue($node_storage->load($revision_node->id()), "Current revision of the user's node was not deleted.");
-    \Drupal::entityManager()->getStorage('comment')->resetCache([$comment->id()]);
+    \Drupal::entityTypeManager()->getStorage('comment')->resetCache([$comment->id()]);
     $this->assertFalse(Comment::load($comment->id()), 'Comment of the user has been deleted.');
 
     // Confirm that the confirmation message made it through to the end user.
diff --git a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php
index 9a660ef3eff3..866b2d324287 100644
--- a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php
+++ b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php
@@ -307,7 +307,7 @@ public function testResetImpersonation() {
       ->fields(['pass' => NULL])
       ->condition('uid', [$user1->id(), $user2->id()], 'IN')
       ->execute();
-    \Drupal::entityManager()->getStorage('user')->resetCache();
+    \Drupal::entityTypeManager()->getStorage('user')->resetCache();
     $user1 = User::load($user1->id());
     $user2 = User::load($user2->id());
 
diff --git a/core/modules/user/tests/src/Functional/UserPermissionsTest.php b/core/modules/user/tests/src/Functional/UserPermissionsTest.php
index baa848ae143e..30ff65648e8c 100644
--- a/core/modules/user/tests/src/Functional/UserPermissionsTest.php
+++ b/core/modules/user/tests/src/Functional/UserPermissionsTest.php
@@ -107,7 +107,7 @@ public function testAdministratorRole() {
     $edit['user_admin_role'] = $this->rid;
     $this->drupalPostForm('admin/config/people/accounts', $edit, t('Save configuration'));
 
-    \Drupal::entityManager()->getStorage('user_role')->resetCache();
+    \Drupal::entityTypeManager()->getStorage('user_role')->resetCache();
     $this->assertTrue(Role::load($this->rid)->isAdmin());
 
     // Enable aggregator module and ensure the 'administer news feeds'
@@ -121,7 +121,7 @@ public function testAdministratorRole() {
     $edit['user_admin_role'] = '';
     $this->drupalPostForm('admin/config/people/accounts', $edit, t('Save configuration'));
 
-    \Drupal::entityManager()->getStorage('user_role')->resetCache();
+    \Drupal::entityTypeManager()->getStorage('user_role')->resetCache();
     \Drupal::configFactory()->reset();
     $this->assertFalse(Role::load($this->rid)->isAdmin());
 
diff --git a/core/modules/user/tests/src/Functional/UserRegistrationTest.php b/core/modules/user/tests/src/Functional/UserRegistrationTest.php
index c9a68328add8..ce1568d83873 100644
--- a/core/modules/user/tests/src/Functional/UserRegistrationTest.php
+++ b/core/modules/user/tests/src/Functional/UserRegistrationTest.php
@@ -208,7 +208,7 @@ public function testUuidFormState() {
     $this->drupalPostForm('user/register', $edit, t('Create new account'));
     $this->assertResponse(200);
 
-    $user_storage = \Drupal::entityManager()->getStorage('user');
+    $user_storage = \Drupal::entityTypeManager()->getStorage('user');
 
     $this->assertTrue($user_storage->loadByProperties(['name' => $edit['name']]));
     $this->drupalLogout();
diff --git a/core/modules/user/tests/src/Functional/UserRoleAdminTest.php b/core/modules/user/tests/src/Functional/UserRoleAdminTest.php
index 739da5484034..c7e52135d695 100644
--- a/core/modules/user/tests/src/Functional/UserRoleAdminTest.php
+++ b/core/modules/user/tests/src/Functional/UserRoleAdminTest.php
@@ -72,7 +72,7 @@ public function testRoleAdministration() {
     $edit = ['label' => $role_name];
     $this->drupalPostForm("admin/people/roles/manage/{$role->id()}", $edit, t('Save'));
     $this->assertRaw(t('Role %label has been updated.', ['%label' => $role_name]));
-    \Drupal::entityManager()->getStorage('user_role')->resetCache([$role->id()]);
+    \Drupal::entityTypeManager()->getStorage('user_role')->resetCache([$role->id()]);
     $new_role = Role::load($role->id());
     $this->assertEqual($new_role->label(), $role_name, 'The role name has been successfully changed.');
 
@@ -82,7 +82,7 @@ public function testRoleAdministration() {
     $this->drupalPostForm(NULL, [], t('Delete'));
     $this->assertRaw(t('The role %label has been deleted.', ['%label' => $role_name]));
     $this->assertNoLinkByHref("admin/people/roles/manage/{$role->id()}", 'Role edit link removed.');
-    \Drupal::entityManager()->getStorage('user_role')->resetCache([$role->id()]);
+    \Drupal::entityTypeManager()->getStorage('user_role')->resetCache([$role->id()]);
     $this->assertFalse(Role::load($role->id()), 'A deleted role can no longer be loaded.');
 
     // Make sure that the system-defined roles can be edited via the user
diff --git a/core/modules/user/tests/src/Functional/UserTranslationUITest.php b/core/modules/user/tests/src/Functional/UserTranslationUITest.php
index 12502680364c..d087d528d719 100644
--- a/core/modules/user/tests/src/Functional/UserTranslationUITest.php
+++ b/core/modules/user/tests/src/Functional/UserTranslationUITest.php
@@ -31,7 +31,7 @@ protected function setUp() {
     $this->name = $this->randomMachineName();
     parent::setUp();
 
-    \Drupal::entityManager()->getStorage('user')->resetCache();
+    \Drupal::entityTypeManager()->getStorage('user')->resetCache();
   }
 
   /**
diff --git a/core/modules/user/tests/src/Functional/Views/AccessRoleTest.php b/core/modules/user/tests/src/Functional/Views/AccessRoleTest.php
index 7f847234aa2d..7f92860f8bb4 100644
--- a/core/modules/user/tests/src/Functional/Views/AccessRoleTest.php
+++ b/core/modules/user/tests/src/Functional/Views/AccessRoleTest.php
@@ -30,7 +30,7 @@ class AccessRoleTest extends AccessTestBase {
    */
   public function testAccessRole() {
     /** @var \Drupal\views\ViewEntityInterface $view */
-    $view = \Drupal::entityManager()->getStorage('view')->load('test_access_role');
+    $view = \Drupal::entityTypeManager()->getStorage('view')->load('test_access_role');
     $display = &$view->getDisplay('default');
     $display['display_options']['access']['options']['role'] = [
       $this->normalRole => $this->normalRole,
diff --git a/core/modules/user/user.install b/core/modules/user/user.install
index 600c2ec26547..2540ac2cd34e 100644
--- a/core/modules/user/user.install
+++ b/core/modules/user/user.install
@@ -69,7 +69,7 @@ function user_schema() {
  * Implements hook_install().
  */
 function user_install() {
-  $storage = \Drupal::entityManager()->getStorage('user');
+  $storage = \Drupal::entityTypeManager()->getStorage('user');
   // Insert a row for the anonymous user.
   $storage
     ->create([
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index 772c4e23b958..47771e2e61de 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -208,7 +208,7 @@ function user_entity_extra_field_info() {
 function user_load_multiple(array $uids = NULL, $reset = FALSE) {
   @trigger_error('user_load_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\user\Entity\User::loadMultiple(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
   if ($reset) {
-    \Drupal::entityManager()->getStorage('user')->resetCache($uids);
+    \Drupal::entityTypeManager()->getStorage('user')->resetCache($uids);
   }
   return User::loadMultiple($uids);
 }
@@ -234,7 +234,7 @@ function user_load_multiple(array $uids = NULL, $reset = FALSE) {
 function user_load($uid, $reset = FALSE) {
   @trigger_error('user_load() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\user\Entity\User::load(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
   if ($reset) {
-    \Drupal::entityManager()->getStorage('user')->resetCache([$uid]);
+    \Drupal::entityTypeManager()->getStorage('user')->resetCache([$uid]);
   }
   return User::load($uid);
 }
@@ -557,7 +557,7 @@ function user_login_finalize(UserInterface $account) {
   // Update the user table timestamp noting user has logged in.
   // This is also used to invalidate one-time login links.
   $account->setLastLoginTime(REQUEST_TIME);
-  \Drupal::entityManager()
+  \Drupal::entityTypeManager()
     ->getStorage('user')
     ->updateLastLoginTimestamp($account);
 
@@ -1075,7 +1075,7 @@ function user_user_role_insert(RoleInterface $role) {
  */
 function user_user_role_delete(RoleInterface $role) {
   // Delete role references for all users.
-  $user_storage = \Drupal::entityManager()->getStorage('user');
+  $user_storage = \Drupal::entityTypeManager()->getStorage('user');
   $user_storage->deleteRoleReferences([$role->id()]);
 
   // Ignore the authenticated and anonymous roles or the role is being synced.
diff --git a/core/modules/views/src/Plugin/views/cache/CachePluginBase.php b/core/modules/views/src/Plugin/views/cache/CachePluginBase.php
index 280ccf4d1627..14ac7994fdbc 100644
--- a/core/modules/views/src/Plugin/views/cache/CachePluginBase.php
+++ b/core/modules/views/src/Plugin/views/cache/CachePluginBase.php
@@ -241,7 +241,7 @@ public function getCacheTags() {
     if (!empty($entity_information)) {
       // Add the list cache tags for each entity type used by this view.
       foreach ($entity_information as $table => $metadata) {
-        $tags = Cache::mergeTags($tags, \Drupal::entityManager()->getDefinition($metadata['entity_type'])->getListCacheTags());
+        $tags = Cache::mergeTags($tags, \Drupal::entityTypeManager()->getDefinition($metadata['entity_type'])->getListCacheTags());
       }
     }
 
diff --git a/core/modules/views/src/Plugin/views/query/QueryPluginBase.php b/core/modules/views/src/Plugin/views/query/QueryPluginBase.php
index 83e0bcfa2403..5d39b9cb1c67 100644
--- a/core/modules/views/src/Plugin/views/query/QueryPluginBase.php
+++ b/core/modules/views/src/Plugin/views/query/QueryPluginBase.php
@@ -316,7 +316,7 @@ public function getEntityTableInfo() {
 
     // Determine which of the tables are revision tables.
     foreach ($entity_tables as $table_alias => $table) {
-      $entity_type = \Drupal::entityManager()->getDefinition($table['entity_type']);
+      $entity_type = \Drupal::entityTypeManager()->getDefinition($table['entity_type']);
       if ($entity_type->getRevisionTable() == $table['base']) {
         $entity_tables[$table_alias]['revision'] = TRUE;
       }
@@ -339,7 +339,7 @@ public function getCacheContexts() {
     $contexts = [];
     if (($views_data = Views::viewsData()->get($this->view->storage->get('base_table'))) && !empty($views_data['table']['entity type'])) {
       $entity_type_id = $views_data['table']['entity type'];
-      $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id);
+      $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id);
       $contexts = $entity_type->getListCacheContexts();
     }
     return $contexts;
diff --git a/core/modules/views/src/Plugin/views/query/Sql.php b/core/modules/views/src/Plugin/views/query/Sql.php
index 03749a329b3e..7503e1d8b158 100644
--- a/core/modules/views/src/Plugin/views/query/Sql.php
+++ b/core/modules/views/src/Plugin/views/query/Sql.php
@@ -1346,7 +1346,7 @@ public function query($get_count = FALSE) {
       }
 
       foreach ($entity_information as $entity_type_id => $info) {
-        $entity_type = \Drupal::entityManager()->getDefinition($info['entity_type']);
+        $entity_type = \Drupal::entityTypeManager()->getDefinition($info['entity_type']);
         $base_field = !$info['revision'] ? $entity_type->getKey('id') : $entity_type->getKey('revision');
         $this->addField($info['alias'], $base_field, '', $params);
       }
diff --git a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
index 20ff84dad7ba..ea9cf95f98a9 100644
--- a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
+++ b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
@@ -139,7 +139,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
     $this->bundleInfoService = $bundle_info_service;
     $this->base_table = $this->definition['base_table'];
 
-    $entity_types = \Drupal::entityManager()->getDefinitions();
+    $entity_types = \Drupal::entityTypeManager()->getDefinitions();
     foreach ($entity_types as $entity_type_id => $entity_type) {
       if (in_array($this->base_table, [$entity_type->getBaseTable(), $entity_type->getDataTable(), $entity_type->getRevisionTable(), $entity_type->getRevisionDataTable()], TRUE)) {
         $this->entityType = $entity_type;
diff --git a/core/modules/views/src/Tests/ViewTestData.php b/core/modules/views/src/Tests/ViewTestData.php
index f0c8cfce7d9f..6033fcfd33f5 100644
--- a/core/modules/views/src/Tests/ViewTestData.php
+++ b/core/modules/views/src/Tests/ViewTestData.php
@@ -31,7 +31,7 @@ public static function createTestViews($class, array $modules) {
       $class = get_parent_class($class);
     }
     if (!empty($views)) {
-      $storage = \Drupal::entityManager()->getStorage('view');
+      $storage = \Drupal::entityTypeManager()->getStorage('view');
       $module_handler = \Drupal::moduleHandler();
       foreach ($modules as $module) {
         $config_dir = drupal_get_path('module', $module) . '/test_views';
diff --git a/core/modules/views/src/Views.php b/core/modules/views/src/Views.php
index dd241f714b60..32cf016fd411 100644
--- a/core/modules/views/src/Views.php
+++ b/core/modules/views/src/Views.php
@@ -242,7 +242,7 @@ public static function getApplicableViews($type) {
    *   An array of loaded view entities.
    */
   public static function getAllViews() {
-    return \Drupal::entityManager()->getStorage('view')->loadMultiple();
+    return \Drupal::entityTypeManager()->getStorage('view')->loadMultiple();
   }
 
   /**
@@ -256,7 +256,7 @@ public static function getEnabledViews() {
       ->condition('status', TRUE)
       ->execute();
 
-    return \Drupal::entityManager()->getStorage('view')->loadMultiple($query);
+    return \Drupal::entityTypeManager()->getStorage('view')->loadMultiple($query);
   }
 
   /**
@@ -270,7 +270,7 @@ public static function getDisabledViews() {
       ->condition('status', FALSE)
       ->execute();
 
-    return \Drupal::entityManager()->getStorage('view')->loadMultiple($query);
+    return \Drupal::entityTypeManager()->getStorage('view')->loadMultiple($query);
   }
 
   /**
diff --git a/core/modules/views/tests/src/Functional/Handler/FieldEntityOperationsTest.php b/core/modules/views/tests/src/Functional/Handler/FieldEntityOperationsTest.php
index 7ced4f7071e0..c8f962dbe8ef 100644
--- a/core/modules/views/tests/src/Functional/Handler/FieldEntityOperationsTest.php
+++ b/core/modules/views/tests/src/Functional/Handler/FieldEntityOperationsTest.php
@@ -69,7 +69,7 @@ public function testEntityOperations() {
       /** @var \Drupal\Core\Language\LanguageInterface $language */
       foreach ($entity->getTranslationLanguages() as $language) {
         $entity = $entity->getTranslation($language->getId());
-        $operations = \Drupal::entityManager()->getListBuilder('node')->getOperations($entity);
+        $operations = \Drupal::service('entity_type.manager')->getListBuilder('node')->getOperations($entity);
         $this->assertTrue(count($operations) > 0, 'There are operations.');
         foreach ($operations as $operation) {
           $expected_destination = Url::fromUri('internal:/test-entity-operations')->toString();
diff --git a/core/modules/views/tests/src/Functional/Wizard/NodeWizardTest.php b/core/modules/views/tests/src/Functional/Wizard/NodeWizardTest.php
index 41870b6db904..21bdf1709da6 100644
--- a/core/modules/views/tests/src/Functional/Wizard/NodeWizardTest.php
+++ b/core/modules/views/tests/src/Functional/Wizard/NodeWizardTest.php
@@ -25,7 +25,7 @@ public function testViewAddWithNodeTitles() {
     $view['page[style][row_plugin]'] = 'titles';
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
 
-    $view_storage_controller = \Drupal::entityManager()->getStorage('view');
+    $view_storage_controller = \Drupal::entityTypeManager()->getStorage('view');
     /** @var \Drupal\views\Entity\View $view */
     $view = $view_storage_controller->load($view['id']);
 
diff --git a/core/modules/views/tests/src/Kernel/Entity/RowEntityRenderersTest.php b/core/modules/views/tests/src/Kernel/Entity/RowEntityRenderersTest.php
index a110f0020949..83e0cb97f5b5 100644
--- a/core/modules/views/tests/src/Kernel/Entity/RowEntityRenderersTest.php
+++ b/core/modules/views/tests/src/Kernel/Entity/RowEntityRenderersTest.php
@@ -94,7 +94,7 @@ protected function setUp($import_test_views = TRUE) {
 
     $this->values = [];
     $this->ids = [];
-    $controller = \Drupal::entityManager()->getStorage('node');
+    $controller = \Drupal::entityTypeManager()->getStorage('node');
     $langcode_index = 0;
 
     for ($i = 0; $i < count($this->langcodes); $i++) {
diff --git a/core/modules/views/tests/src/Kernel/Handler/AreaEntityTest.php b/core/modules/views/tests/src/Kernel/Handler/AreaEntityTest.php
index 2ccaac6f31e9..0d3ce325d44d 100644
--- a/core/modules/views/tests/src/Kernel/Handler/AreaEntityTest.php
+++ b/core/modules/views/tests/src/Kernel/Handler/AreaEntityTest.php
@@ -149,7 +149,7 @@ public function doTestRender($entities) {
     $this->assertTrue(strpos(trim((string) $result[0]), 'full') !== FALSE, 'The rendered entity appeared in the right view mode.');
 
     // Mark entity_test test view_mode as customizable.
-    $entity_view_mode = \Drupal::entityManager()->getStorage('entity_view_mode')->load('entity_test.test');
+    $entity_view_mode = \Drupal::entityTypeManager()->getStorage('entity_view_mode')->load('entity_test.test');
     $entity_view_mode->enable();
     $entity_view_mode->save();
 
diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldFieldAccessTestBase.php b/core/modules/views/tests/src/Kernel/Handler/FieldFieldAccessTestBase.php
index 5ff77bc9f4dd..327bfc14814f 100644
--- a/core/modules/views/tests/src/Kernel/Handler/FieldFieldAccessTestBase.php
+++ b/core/modules/views/tests/src/Kernel/Handler/FieldFieldAccessTestBase.php
@@ -83,7 +83,7 @@ protected function setUp($import_test_views = TRUE) {
   protected function assertFieldAccess($entity_type_id, $field_name, $field_content) {
     \Drupal::state()->set('views_field_access_test-field', $field_name);
 
-    $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id);
+    $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id);
     $view_id = $this->randomMachineName();
     $data_table = $entity_type->getDataTable();
     // Use the data table as long as the field is not 'uuid'. This is the only
diff --git a/core/modules/views/tests/src/Kernel/ViewStorageTest.php b/core/modules/views/tests/src/Kernel/ViewStorageTest.php
index e6cce86f2eff..b60df267b34a 100644
--- a/core/modules/views/tests/src/Kernel/ViewStorageTest.php
+++ b/core/modules/views/tests/src/Kernel/ViewStorageTest.php
@@ -59,7 +59,7 @@ class ViewStorageTest extends ViewsKernelTestBase {
    */
   public function testConfigurationEntityCRUD() {
     // Get the configuration entity type and controller.
-    $this->entityType = \Drupal::entityManager()->getDefinition('view');
+    $this->entityType = \Drupal::entityTypeManager()->getDefinition('view');
     $this->controller = $this->container->get('entity.manager')->getStorage('view');
 
     // Confirm that an info array has been returned.
diff --git a/core/modules/views/views.api.php b/core/modules/views/views.api.php
index bf0fd7014e04..9889c93e325d 100644
--- a/core/modules/views/views.api.php
+++ b/core/modules/views/views.api.php
@@ -557,9 +557,9 @@ function hook_field_views_data(\Drupal\field\FieldStorageConfigInterface $field_
 function hook_field_views_data_alter(array &$data, \Drupal\field\FieldStorageConfigInterface $field_storage) {
   $entity_type_id = $field_storage->getTargetEntityTypeId();
   $field_name = $field_storage->getName();
-  $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id);
+  $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id);
   $pseudo_field_name = 'reverse_' . $field_name . '_' . $entity_type_id;
-  $table_mapping = \Drupal::entityManager()->getStorage($entity_type_id)->getTableMapping();
+  $table_mapping = \Drupal::entityTypeManager()->getStorage($entity_type_id)->getTableMapping();
 
   list($label) = views_entity_field_label($entity_type_id, $field_name);
 
@@ -614,10 +614,10 @@ function hook_field_views_data_views_data_alter(array &$data, \Drupal\field\Fiel
   $field_name = $field->getName();
   $data_key = 'field_data_' . $field_name;
   $entity_type_id = $field->entity_type;
-  $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id);
+  $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id);
   $pseudo_field_name = 'reverse_' . $field_name . '_' . $entity_type_id;
   list($label) = views_entity_field_label($entity_type_id, $field_name);
-  $table_mapping = \Drupal::entityManager()->getStorage($entity_type_id)->getTableMapping();
+  $table_mapping = \Drupal::entityTypeManager()->getStorage($entity_type_id)->getTableMapping();
 
   // Views data for this field is in $data[$data_key].
   $data[$data_key][$pseudo_field_name]['relationship'] = [
diff --git a/core/modules/views/views.module b/core/modules/views/views.module
index 4e06b7510c51..25349a33eeb4 100644
--- a/core/modules/views/views.module
+++ b/core/modules/views/views.module
@@ -399,7 +399,7 @@ function views_add_contextual_links(&$render_element, $location, $display_id, ar
         $args = [];
         $valid = TRUE;
         if (!empty($link['route_parameters_names'])) {
-          $view_storage = \Drupal::entityManager()
+          $view_storage = \Drupal::entityTypeManager()
             ->getStorage('view')
             ->load($view_id);
           foreach ($link['route_parameters_names'] as $parameter_name => $property) {
diff --git a/core/modules/views/views.post_update.php b/core/modules/views/views.post_update.php
index 30749fcba87d..8c10f65e4f0c 100644
--- a/core/modules/views/views.post_update.php
+++ b/core/modules/views/views.post_update.php
@@ -17,7 +17,7 @@
  */
 function views_post_update_update_cacheability_metadata() {
   // Load all views.
-  $views = \Drupal::entityManager()->getStorage('view')->loadMultiple();
+  $views = \Drupal::entityTypeManager()->getStorage('view')->loadMultiple();
 
   /* @var \Drupal\views\Entity\View[] $views */
   foreach ($views as $view) {
diff --git a/core/modules/views/views.views.inc b/core/modules/views/views.views.inc
index 9c86a3a3479c..39a8f7239cf4 100644
--- a/core/modules/views/views.views.inc
+++ b/core/modules/views/views.views.inc
@@ -138,7 +138,7 @@ function views_views_data() {
   ];
 
   // Registers an entity area handler per entity type.
-  foreach (\Drupal::entityManager()->getDefinitions() as $entity_type_id => $entity_type) {
+  foreach (\Drupal::entityTypeManager()->getDefinitions() as $entity_type_id => $entity_type) {
     // Excludes entity types, which cannot be rendered.
     if ($entity_type->hasViewBuilderClass()) {
       $label = $entity_type->getLabel();
@@ -154,8 +154,8 @@ function views_views_data() {
   }
 
   // Registers an action bulk form per entity.
-  foreach (\Drupal::entityManager()->getDefinitions() as $entity_type => $entity_info) {
-    $actions = array_filter(\Drupal::entityManager()->getStorage('action')->loadMultiple(), function (ActionConfigEntityInterface $action) use ($entity_type) {
+  foreach (\Drupal::entityTypeManager()->getDefinitions() as $entity_type => $entity_info) {
+    $actions = array_filter(\Drupal::entityTypeManager()->getStorage('action')->loadMultiple(), function (ActionConfigEntityInterface $action) use ($entity_type) {
       return $action->getType() == $entity_type;
     });
     if (empty($actions)) {
@@ -171,10 +171,10 @@ function views_views_data() {
   }
 
   // Registers views data for the entity itself.
-  foreach (\Drupal::entityManager()->getDefinitions() as $entity_type_id => $entity_type) {
+  foreach (\Drupal::entityTypeManager()->getDefinitions() as $entity_type_id => $entity_type) {
     if ($entity_type->hasHandlerClass('views_data')) {
       /** @var \Drupal\views\EntityViewsDataInterface $views_data */
-      $views_data = \Drupal::entityManager()->getHandler($entity_type_id, 'views_data');
+      $views_data = \Drupal::entityTypeManager()->getHandler($entity_type_id, 'views_data');
       $data = NestedArray::mergeDeep($data, $views_data->getViewsData());
     }
   }
@@ -183,10 +183,10 @@ function views_views_data() {
   // behavior for adding fields.
   $module_handler = \Drupal::moduleHandler();
 
-  $entity_manager = \Drupal::entityManager();
-  if ($entity_manager->hasDefinition('field_storage_config')) {
+  $entity_type_manager = \Drupal::entityTypeManager();
+  if ($entity_type_manager->hasDefinition('field_storage_config')) {
     /** @var \Drupal\field\FieldStorageConfigInterface $field_storage */
-    foreach ($entity_manager->getStorage('field_storage_config')->loadMultiple() as $field_storage) {
+    foreach ($entity_type_manager->getStorage('field_storage_config')->loadMultiple() as $field_storage) {
       if (_views_field_get_entity_type_storage($field_storage)) {
         $result = (array) $module_handler->invoke($field_storage->getTypeProvider(), 'field_views_data', [$field_storage]);
         if (empty($result)) {
@@ -213,7 +213,7 @@ function views_views_data() {
  * in views_views_data().
  */
 function views_views_data_alter(&$data) {
-  $entity_manager = \Drupal::entityManager();
+  $entity_manager = \Drupal::entityTypeManager();
   if (!$entity_manager->hasDefinition('field_storage_config')) {
     return;
   }
@@ -239,7 +239,7 @@ function views_views_data_alter(&$data) {
  */
 function _views_field_get_entity_type_storage(FieldStorageConfigInterface $field_storage) {
   $result = FALSE;
-  $entity_manager = \Drupal::entityManager();
+  $entity_manager = \Drupal::entityTypeManager();
   if ($entity_manager->hasDefinition($field_storage->getTargetEntityTypeId())) {
     $storage = $entity_manager->getStorage($field_storage->getTargetEntityTypeId());
     $result = $storage instanceof SqlContentEntityStorage ? $storage : FALSE;
@@ -321,9 +321,9 @@ function views_field_default_views_data(FieldStorageConfigInterface $field_stora
 
   // Grab information about the entity type tables.
   // We need to join to both the base table and the data table, if available.
-  $entity_manager = \Drupal::entityManager();
+  $entity_type_manager = \Drupal::entityTypeManager();
   $entity_type_id = $field_storage->getTargetEntityTypeId();
-  $entity_type = $entity_manager->getDefinition($entity_type_id);
+  $entity_type = $entity_type_manager->getDefinition($entity_type_id);
   if (!$base_table = $entity_type->getBaseTable()) {
     // We cannot do anything if for some reason there is no base table.
     return $data;
@@ -776,17 +776,17 @@ function core_field_views_data(FieldStorageConfigInterface $field_storage) {
     return $data;
   }
 
-  $entity_manager = \Drupal::entityManager();
+  $entity_type_manager = \Drupal::entityTypeManager();
   $entity_type_id = $field_storage->getTargetEntityTypeId();
   /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
-  $table_mapping = $entity_manager->getStorage($entity_type_id)->getTableMapping();
+  $table_mapping = $entity_type_manager->getStorage($entity_type_id)->getTableMapping();
 
   foreach ($data as $table_name => $table_data) {
     // Add a relationship to the target entity type.
     $target_entity_type_id = $field_storage->getSetting('target_type');
-    $target_entity_type = $entity_manager->getDefinition($target_entity_type_id);
+    $target_entity_type = $entity_type_manager->getDefinition($target_entity_type_id);
     $entity_type_id = $field_storage->getTargetEntityTypeId();
-    $entity_type = $entity_manager->getDefinition($entity_type_id);
+    $entity_type = $entity_type_manager->getDefinition($entity_type_id);
     $target_base_table = $target_entity_type->getDataTable() ?: $target_entity_type->getBaseTable();
     $field_name = $field_storage->getName();
 
diff --git a/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php b/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php
index 619b1914654a..65d45eee5c33 100644
--- a/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php
+++ b/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php
@@ -165,7 +165,7 @@ public function getForm(ViewEntityInterface $view, $display_id, $js) {
     // If this form was for view-wide changes, there's no need to regenerate
     // the display section of the form.
     if ($display_id !== '') {
-      \Drupal::entityManager()->getFormObject('view', 'edit')->rebuildCurrentTab($view, $response, $display_id);
+      \Drupal::entityTypeManager()->getFormObject('view', 'edit')->rebuildCurrentTab($view, $response, $display_id);
     }
 
     return $response;
diff --git a/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php b/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php
index 2f007f193c68..5973a5d59bfc 100644
--- a/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php
@@ -212,7 +212,7 @@ public function testDefaultMenuTabRegression() {
     ];
     $this->drupalPostForm('admin/structure/menu/manage/admin/add', $edit, t('Save'));
 
-    $menu_items = \Drupal::entityManager()->getStorage('menu_link_content')->getQuery()
+    $menu_items = \Drupal::entityTypeManager()->getStorage('menu_link_content')->getQuery()
       ->sort('id', 'DESC')
       ->pager(1)
       ->execute();
diff --git a/core/modules/views_ui/tests/src/Functional/ViewEditTest.php b/core/modules/views_ui/tests/src/Functional/ViewEditTest.php
index 94f9da814446..bfe5b05d071f 100644
--- a/core/modules/views_ui/tests/src/Functional/ViewEditTest.php
+++ b/core/modules/views_ui/tests/src/Functional/ViewEditTest.php
@@ -58,7 +58,7 @@ public function testOtherOptions() {
 
     // Save the view, and test the new ID has been saved.
     $this->drupalPostForm(NULL, [], 'Save');
-    $view = \Drupal::entityManager()->getStorage('view')->load('test_view');
+    $view = \Drupal::entityTypeManager()->getStorage('view')->load('test_view');
     $displays = $view->get('display');
     $this->assertTrue(!empty($displays['test_1']), 'Display data found for new display ID key.');
     $this->assertIdentical($displays['test_1']['id'], 'test_1', 'New display ID matches the display ID key.');
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php
index 1cd9cb17537a..aaeeb9d31eb8 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php
@@ -86,7 +86,7 @@ public function testReset() {
    */
   public function testConfigOverride() {
     /** @var \Drupal\Core\Config\Entity\ConfigEntityStorage $storage */
-    $storage = \Drupal::entityManager()->getStorage($this->entityTypeId);
+    $storage = \Drupal::entityTypeManager()->getStorage($this->entityTypeId);
     // Prime the cache prior to adding a config override.
     $storage->load($this->entityId);
 
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php
index 1fce8a498dd7..fcc472f9e2c9 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php
@@ -46,7 +46,7 @@ protected function setUp() {
    * Tests storage methods.
    */
   public function testStorageMethods() {
-    $entity_type = \Drupal::entityManager()->getDefinition('config_test');
+    $entity_type = \Drupal::entityTypeManager()->getDefinition('config_test');
 
     // Test the static extractID() method.
     $expected_id = 'test_id';
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
index 6489b06799e9..70dbb874c96f 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
@@ -244,7 +244,7 @@ public function testSecondaryWritePrimaryFirst() {
     // Import.
     $this->configImporter->reset()->import();
 
-    $entity_storage = \Drupal::entityManager()->getStorage('config_test');
+    $entity_storage = \Drupal::entityTypeManager()->getStorage('config_test');
     $primary = $entity_storage->load('primary');
     $this->assertEqual($primary->id(), 'primary');
     $this->assertEqual($primary->uuid(), $values_primary['uuid']);
@@ -290,7 +290,7 @@ public function testSecondaryWriteSecondaryFirst() {
     // Import.
     $this->configImporter->reset()->import();
 
-    $entity_storage = \Drupal::entityManager()->getStorage('config_test');
+    $entity_storage = \Drupal::entityTypeManager()->getStorage('config_test');
     $primary = $entity_storage->load('primary');
     $this->assertEqual($primary->id(), 'primary');
     $this->assertEqual($primary->uuid(), $values_primary['uuid']);
@@ -367,7 +367,7 @@ public function testSecondaryUpdateDeletedDeleterFirst() {
     // Import.
     $this->configImporter->import();
 
-    $entity_storage = \Drupal::entityManager()->getStorage('config_test');
+    $entity_storage = \Drupal::entityTypeManager()->getStorage('config_test');
     $deleter = $entity_storage->load('deleter');
     $this->assertEqual($deleter->id(), 'deleter');
     $this->assertEqual($deleter->uuid(), $values_deleter['uuid']);
@@ -427,7 +427,7 @@ public function testSecondaryUpdateDeletedDeleteeFirst() {
     // Import.
     $this->configImporter->reset()->import();
 
-    $entity_storage = \Drupal::entityManager()->getStorage('config_test');
+    $entity_storage = \Drupal::entityTypeManager()->getStorage('config_test');
     // Both entities are deleted. ConfigTest::postSave() causes updates of the
     // deleter entity to delete the deletee entity. Since the deleter depends on
     // the deletee, removing the deletee causes the deleter to be removed.
@@ -469,7 +469,7 @@ public function testSecondaryDeletedDeleteeSecond() {
     // Import.
     $this->configImporter->reset()->import();
 
-    $entity_storage = \Drupal::entityManager()->getStorage('config_test');
+    $entity_storage = \Drupal::entityTypeManager()->getStorage('config_test');
     $this->assertFalse($entity_storage->load('deleter'));
     $this->assertFalse($entity_storage->load('deletee'));
     // The deletee entity does not exist as the delete worked and although the
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php
index 5efd20bbb15d..89b284612c5b 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigInstallTest.php
@@ -223,7 +223,7 @@ public function testDependencyChecking() {
     }
     $this->installModules(['config_other_module_config_test']);
     $this->installModules(['config_install_dependency_test']);
-    $entity = \Drupal::entityManager()->getStorage('config_test')->load('other_module_test_with_dependency');
+    $entity = \Drupal::entityTypeManager()->getStorage('config_test')->load('other_module_test_with_dependency');
     $this->assertTrue($entity, 'The config_test.dynamic.other_module_test_with_dependency configuration has been created during install.');
     // Ensure that dependencies can be added during module installation by
     // hooks.
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php
index db5569029555..3f253f6d1829 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php
@@ -93,7 +93,7 @@ protected function assertCRUD($entity_type, UserInterface $user1) {
     $this->assertTrue(empty($all), format_string('%entity_type: Deleted all entities.', ['%entity_type' => $entity_type]));
 
     // Verify that all data got deleted.
-    $definition = \Drupal::entityManager()->getDefinition($entity_type);
+    $definition = \Drupal::entityTypeManager()->getDefinition($entity_type);
     $this->assertEqual(0, db_query('SELECT COUNT(*) FROM {' . $definition->getBaseTable() . '}')->fetchField(), 'Base table was emptied');
     if ($data_table = $definition->getDataTable()) {
       $this->assertEqual(0, db_query('SELECT COUNT(*) FROM {' . $data_table . '}')->fetchField(), 'Data table was emptied');
@@ -113,7 +113,7 @@ protected function assertCRUD($entity_type, UserInterface $user1) {
     $entity = $storage->create(['name' => 'test2', 'user_id' => $user1->id()]);
     $entity->save();
     $entities['test2'] = $entity;
-    $controller = \Drupal::entityManager()->getStorage($entity_type);
+    $controller = \Drupal::entityTypeManager()->getStorage($entity_type);
     $controller->delete($entities);
 
     // Verify that entities got deleted.
@@ -121,7 +121,7 @@ protected function assertCRUD($entity_type, UserInterface $user1) {
     $this->assertTrue(empty($all), format_string('%entity_type: Deleted all entities.', ['%entity_type' => $entity_type]));
 
     // Verify that all data got deleted from the tables.
-    $definition = \Drupal::entityManager()->getDefinition($entity_type);
+    $definition = \Drupal::entityTypeManager()->getDefinition($entity_type);
     $this->assertEqual(0, db_query('SELECT COUNT(*) FROM {' . $definition->getBaseTable() . '}')->fetchField(), 'Base table was emptied');
     if ($data_table = $definition->getDataTable()) {
       $this->assertEqual(0, db_query('SELECT COUNT(*) FROM {' . $data_table . '}')->fetchField(), 'Data table was emptied');
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php
index bb9645886b66..f8be106cbc84 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php
@@ -323,7 +323,7 @@ public function testCleanUpStorageDefinition() {
     // Find all the entity types provided by the entity_test module and install
     // the schema for them.
     $entity_type_ids = [];
-    $entities = \Drupal::entityManager()->getDefinitions();
+    $entities = \Drupal::entityTypeManager()->getDefinitions();
     foreach ($entities as $entity_type_id => $definition) {
       if ($definition->getProvider() == 'entity_test') {
         $this->installEntitySchema($entity_type_id);
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
index 40d9488c60d4..76e7004d23c0 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
@@ -93,7 +93,7 @@ protected function setUp() {
     $this->field->save();
 
     /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
-    $table_mapping = \Drupal::entityManager()->getStorage($entity_type)->getTableMapping();
+    $table_mapping = \Drupal::entityTypeManager()->getStorage($entity_type)->getTableMapping();
     $this->tableMapping = $table_mapping;
     $this->table = $table_mapping->getDedicatedDataTableName($this->fieldStorage);
     $this->revisionTable = $table_mapping->getDedicatedRevisionTableName($this->fieldStorage);
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php
index 1edc386b2026..c1900c52a15a 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php
@@ -78,7 +78,7 @@ protected function assertFieldStorageLangcode(FieldableEntityInterface $entity,
     $langcode = $entity->getUntranslated()->language()->getId();
     $fields = [$this->fieldName, $this->untranslatableFieldName];
     /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
-    $table_mapping = \Drupal::entityManager()->getStorage($entity_type)->getTableMapping();
+    $table_mapping = \Drupal::entityTypeManager()->getStorage($entity_type)->getTableMapping();
 
     foreach ($fields as $field_name) {
       $field_storage = FieldStorageConfig::loadByName($entity_type, $field_name);
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldWidgetConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldWidgetConstraintValidatorTest.php
index bcb68469a46a..2f5f85218cf1 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/FieldWidgetConstraintValidatorTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldWidgetConstraintValidatorTest.php
@@ -45,7 +45,7 @@ public function testValidation() {
     $display->buildForm($entity, $form, $form_state);
 
     // Pretend the form has been built.
-    $form_state->setFormObject(\Drupal::entityManager()->getFormObject($entity_type, 'default'));
+    $form_state->setFormObject(\Drupal::entityTypeManager()->getFormObject($entity_type, 'default'));
     \Drupal::formBuilder()->prepareForm('field_test_entity_form', $form, $form_state);
     \Drupal::formBuilder()->processForm('field_test_entity_form', $form, $form_state);
 
@@ -83,7 +83,7 @@ protected function getErrorsForEntity(EntityInterface $entity, $hidden_fields =
     $form_state = new FormState();
     $display->buildForm($entity, $form, $form_state);
 
-    $form_state->setFormObject(\Drupal::entityManager()->getFormObject($entity_type_id, 'default'));
+    $form_state->setFormObject(\Drupal::entityTypeManager()->getFormObject($entity_type_id, 'default'));
     \Drupal::formBuilder()->prepareForm('field_test_entity_form', $form, $form_state);
     \Drupal::formBuilder()->processForm('field_test_entity_form', $form, $form_state);
 
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php b/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php
index 8a959c3c71d9..aa2a042ddb78 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php
@@ -42,7 +42,7 @@ protected function setUp() {
    */
   public function testRevisionableContentEntity() {
     $entity_type = 'entity_test_mul_revlog';
-    $definition = \Drupal::entityManager()->getDefinition($entity_type);
+    $definition = \Drupal::entityTypeManager()->getDefinition($entity_type);
     $user = User::create(['name' => 'test name']);
     $user->save();
     /** @var \Drupal\entity_test_mul_revlog\Entity\EntityTestMulWithRevisionLog $entity */
diff --git a/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php
index a998f0fea85d..42d8110e1963 100644
--- a/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php
@@ -61,12 +61,12 @@ protected function setUp() {
    * Tests deleting all the links in a menu.
    */
   public function testDeleteLinksInMenu() {
-    \Drupal::entityManager()->getStorage('menu')->create(['id' => 'menu1'])->save();
-    \Drupal::entityManager()->getStorage('menu')->create(['id' => 'menu2'])->save();
+    \Drupal::entityTypeManager()->getStorage('menu')->create(['id' => 'menu1'])->save();
+    \Drupal::entityTypeManager()->getStorage('menu')->create(['id' => 'menu2'])->save();
 
-    \Drupal::entityManager()->getStorage('menu_link_content')->create(['link' => ['uri' => 'internal:/menu_name_test'], 'menu_name' => 'menu1', 'bundle' => 'menu_link_content', 'title' => 'Link test'])->save();
-    \Drupal::entityManager()->getStorage('menu_link_content')->create(['link' => ['uri' => 'internal:/menu_name_test'], 'menu_name' => 'menu1', 'bundle' => 'menu_link_content', 'title' => 'Link test'])->save();
-    \Drupal::entityManager()->getStorage('menu_link_content')->create(['link' => ['uri' => 'internal:/menu_name_test'], 'menu_name' => 'menu2', 'bundle' => 'menu_link_content', 'title' => 'Link test'])->save();
+    \Drupal::entityTypeManager()->getStorage('menu_link_content')->create(['link' => ['uri' => 'internal:/menu_name_test'], 'menu_name' => 'menu1', 'bundle' => 'menu_link_content', 'title' => 'Link test'])->save();
+    \Drupal::entityTypeManager()->getStorage('menu_link_content')->create(['link' => ['uri' => 'internal:/menu_name_test'], 'menu_name' => 'menu1', 'bundle' => 'menu_link_content', 'title' => 'Link test'])->save();
+    \Drupal::entityTypeManager()->getStorage('menu_link_content')->create(['link' => ['uri' => 'internal:/menu_name_test'], 'menu_name' => 'menu2', 'bundle' => 'menu_link_content', 'title' => 'Link test'])->save();
 
     $output = $this->linkTree->load('menu1', new MenuTreeParameters());
     $this->assertEqual(count($output), 2);
diff --git a/core/tests/Drupal/Tests/Core/DrupalTest.php b/core/tests/Drupal/Tests/Core/DrupalTest.php
index dfb7d9d641c9..3ed2b0d9dc29 100644
--- a/core/tests/Drupal/Tests/Core/DrupalTest.php
+++ b/core/tests/Drupal/Tests/Core/DrupalTest.php
@@ -79,6 +79,8 @@ public function testCurrentUser() {
    * Tests the entityManager() method.
    *
    * @covers ::entityManager
+   * @group legacy
+   * @expectedDeprecation \Drupal::entityManager() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal::entityTypeManager() instead in most cases. If the needed method is not on \Drupal\Core\Entity\EntityTypeManagerInterface, see the deprecated \Drupal\Core\Entity\EntityManager to find the correct interface or service. See https://www.drupal.org/node/2549139
    */
   public function testEntityManager() {
     $this->setMockContainerService('entity.manager');
diff --git a/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php b/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php
index 4ae518290357..aa5807f8f9c8 100644
--- a/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php
+++ b/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php
@@ -110,13 +110,13 @@ protected function setUp() {
         [['anonymous', 'role_one', 'role_two'], [$roles['role_one'], $roles['role_two']]],
       ]));
 
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
-    $entity_manager->expects($this->any())
+    $entity_type_manager = $this->getMock('Drupal\Core\Entity\EntityTypeManagerInterface');
+    $entity_type_manager->expects($this->any())
       ->method('getStorage')
       ->with($this->equalTo('user_role'))
       ->will($this->returnValue($role_storage));
     $container = new ContainerBuilder();
-    $container->set('entity.manager', $entity_manager);
+    $container->set('entity_type.manager', $entity_type_manager);
     \Drupal::setContainer($container);
 
     $this->users['user_one'] = $this->createUserSession(['role_one']);
-- 
GitLab