From 408c540ccf24e71daf6ea02a878b5869abc2f926 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Thu, 30 May 2019 12:36:55 +0100 Subject: [PATCH] Issue #2886622 by Berdir, martin107, Mile23, tim.plunkett, mikelutz, jonathan1055: Deprecate all EntityManager methods with E_USER_DEPRECATED --- .../Core/Action/Plugin/Action/EmailAction.php | 2 +- .../Controller/EntityViewController.php | 2 +- .../Core/Entity/Entity/EntityFormMode.php | 4 +- ...EntityDefinitionUpdateManagerInterface.php | 9 +- .../EntityDeleteMultipleAccessCheck.php | 2 +- core/lib/Drupal/Core/Entity/EntityManager.php | 15 +- .../Drupal/Core/Entity/EntityTypeEvents.php | 6 +- .../Core/Entity/FieldableEntityInterface.php | 6 +- .../DefaultSelection.php | 2 +- .../Routing/DefaultHtmlRouteProvider.php | 2 +- core/lib/Drupal/Core/Entity/entity.api.php | 6 +- .../ModuleUninstallValidatorInterface.php | 4 +- .../Field/FieldStorageDefinitionEvents.php | 6 +- .../FieldFormatter/TimestampFormatter.php | 2 +- .../Core/Installer/Form/SiteConfigureForm.php | 2 +- .../action/src/Form/ActionFormBase.php | 2 +- .../tests/src/Functional/ActionListTest.php | 2 +- .../aggregator/src/Form/OpmlFeedAdd.php | 2 +- .../src/Plugin/views/argument/Iid.php | 7 +- .../src/Functional/AggregatorAdminTest.php | 4 +- .../Functional/AggregatorRenderingTest.php | 2 +- .../tests/src/Functional/DeleteFeedTest.php | 2 +- .../src/Kernel/Views/IntegrationTest.php | 4 +- core/modules/block/src/BlockForm.php | 2 +- .../DisplayVariant/BlockPageVariant.php | 4 +- .../Plugin/migrate/process/BlockPluginId.php | 4 +- .../block/tests/src/Unit/BlockFormTest.php | 12 +- .../src/Controller/BlockContentController.php | 6 +- .../src/Plugin/Derivative/BlockContent.php | 4 +- .../Functional/BlockContentCacheTagsTest.php | 2 +- .../src/Functional/BlockContentListTest.php | 2 +- .../Functional/BlockContentListViewsTest.php | 2 +- .../src/Functional/BlockContentTypeTest.php | 2 +- .../book/src/Form/BookAdminEditForm.php | 4 +- .../src/Plugin/Block/BookNavigationBlock.php | 2 +- .../views/argument_default/TopLevelBook.php | 2 +- .../book/tests/src/Functional/BookTest.php | 2 +- .../book/tests/src/Unit/BookManagerTest.php | 10 +- .../src/Plugin/migrate/source/d7/Color.php | 2 +- .../Action/UnpublishByKeywordComment.php | 2 +- .../Menu/LocalTask/UnapprovedComments.php | 2 +- .../CommentNameConstraintValidator.php | 2 +- .../src/Functional/CommentStatisticsTest.php | 2 +- .../Views/CommentViewsKernelTestBase.php | 6 +- .../Functional/ConfigDependencyWebTest.php | 2 +- .../ConfigEntityFormOverrideTest.php | 2 +- .../src/Functional/ConfigEntityListTest.php | 2 +- .../ConfigTranslationOverviewTest.php | 2 +- .../tests/src/Unit/ConfigEntityMapperTest.php | 18 +-- .../tests/src/Unit/ConfigFieldMapperTest.php | 12 +- .../tests/src/Kernel/MessageEntityTest.php | 2 +- .../src/ContentTranslationPermissions.php | 2 +- .../src/Tests/ContentTranslationTestBase.php | 2 +- .../ContentTranslationSettingsTest.php | 10 -- .../Functional/ContentTranslationTestBase.php | 4 +- .../Update/ContentTranslationUpdateTest.php | 8 -- .../ContentTranslationConfigImportTest.php | 2 +- .../FieldFormatter/DateTimeFormatterBase.php | 2 +- .../FieldWidget/DateTimeDefaultWidget.php | 2 +- .../editor/src/Form/EditorImageDialog.php | 2 +- .../src/Unit/EditorConfigEntityUnitTest.php | 7 - core/modules/field/src/FieldConfigStorage.php | 2 +- .../field/src/FieldStorageConfigStorage.php | 2 +- .../field/tests/src/Functional/FormTest.php | 4 +- .../tests/src/Kernel/FieldAttachOtherTest.php | 2 +- .../src/Kernel/FieldAttachStorageTest.php | 6 +- .../field/tests/src/Kernel/FieldCrudTest.php | 2 +- .../tests/src/Kernel/FieldDataCountTest.php | 2 +- .../tests/src/Kernel/FieldKernelTestBase.php | 2 +- .../src/Unit/FieldConfigEntityUnitTest.php | 13 -- ...dStorageConfigAccessControlHandlerTest.php | 7 - .../Unit/FieldStorageConfigEntityUnitTest.php | 6 - .../ManageDisplayTest.php | 6 - .../file/src/Tests/FileFieldTestBase.php | 6 +- .../src/Functional/FileFieldDisplayTest.php | 2 +- .../src/Functional/FileFieldPathTest.php | 2 +- .../Functional/FileFieldRSSContentTest.php | 2 +- .../src/Functional/FileFieldRevisionTest.php | 2 +- .../src/Functional/FileFieldTestBase.php | 6 +- .../src/Functional/FileFieldValidateTest.php | 8 +- .../src/Functional/FileFieldWidgetTest.php | 4 +- .../tests/src/Functional/FilePrivateTest.php | 4 +- .../src/Functional/FileTokenReplaceTest.php | 2 +- .../Kernel/Migrate/d6/MigrateUploadTest.php | 2 +- .../file/tests/src/Kernel/SpaceUsedTest.php | 2 +- core/modules/filter/src/FilterPermissions.php | 2 +- .../Functional/Views/ForumIntegrationTest.php | 6 +- .../image/src/Form/ImageStyleEditForm.php | 2 +- .../image/src/Form/ImageStyleFormBase.php | 2 +- .../Field/FieldFormatter/ImageFormatter.php | 2 +- .../ImageFieldDefaultImagesTest.php | 2 +- .../src/Functional/ImageFieldDisplayTest.php | 6 +- .../src/Kernel/ImageStyleIntegrationTest.php | 2 +- .../image/tests/src/Unit/ImageStyleTest.php | 10 +- .../src/Form/NegotiationConfigureForm.php | 4 +- .../LanguageNegotiationContentEntity.php | 2 +- .../src/Kernel/EntityDefaultLanguageTest.php | 6 +- .../Unit/ContentLanguageSettingsUnitTest.php | 13 -- .../src/Unit/DefaultsSectionStorageTest.php | 4 +- .../tests/src/Functional/LinkFieldTest.php | 4 +- .../src/Functional/MediaRevisionTest.php | 2 +- .../src/Plugin/Derivative/MigrateEntity.php | 2 +- .../Derivative/MigrateEntityRevision.php | 2 +- .../src/Plugin/migrate/destination/Entity.php | 2 +- .../migrate/destination/EntityConfigBase.php | 2 +- .../Plugin/migrate/process/MenuLinkParent.php | 2 +- .../Kernel/MigrateEntityContentBaseTest.php | 2 +- .../Kernel/MigrateExternalTranslatedTest.php | 2 +- .../Unit/destination/EntityRevisionTest.php | 8 +- .../destination/EntityFieldStorageConfig.php | 2 +- .../Plugin/migrate/source/DrupalSqlBase.php | 2 +- .../source/d6/D6VariableTranslation.php | 6 +- .../src/Unit/source/DrupalSqlBaseTest.php | 10 +- .../src/Unit/source/d6/Drupal6SqlBaseTest.php | 6 +- .../node/src/Form/NodeRevisionDeleteForm.php | 6 +- .../node/src/Form/NodeRevisionRevertForm.php | 2 +- .../NodeRevisionRevertTranslationForm.php | 2 +- .../node/src/Plugin/Condition/NodeType.php | 2 +- .../src/Plugin/migrate/source/d6/Node.php | 2 +- .../src/Plugin/migrate/source/d6/ViewMode.php | 2 +- .../src/Plugin/migrate/source/d7/Node.php | 2 +- .../node/src/Plugin/views/argument/Nid.php | 2 +- .../node/src/Plugin/views/argument/Type.php | 4 +- .../node/src/Plugin/views/argument/Vid.php | 2 +- .../tests/src/Functional/NodeEditFormTest.php | 2 +- .../src/Functional/NodeRevisionsAllTest.php | 2 +- .../src/Functional/NodeRevisionsTest.php | 6 +- .../NodeRevisionsUiBypassAccessTest.php | 2 +- .../src/Functional/NodeRevisionsUiTest.php | 2 +- .../src/Functional/Views/BulkFormTest.php | 2 +- .../src/Functional/Views/FrontPageTest.php | 2 +- .../tests/src/Kernel/NodeListBuilderTest.php | 2 +- .../tests/src/Functional/PathLanguageTest.php | 2 +- .../quickedit/src/Form/QuickEditFieldForm.php | 2 +- .../Functional/FileFieldAttributesTest.php | 2 +- .../Unit/RdfMappingConfigEntityUnitTest.php | 11 -- .../ResponsiveImageFormatter.php | 4 +- .../ResponsiveImageFieldDisplayTest.php | 12 +- .../EntityResourcePostRouteSubscriber.php | 2 +- .../rest/src/Plugin/Deriver/EntityDeriver.php | 2 +- core/modules/rest/src/RestPermissions.php | 2 +- .../migrate/destination/EntitySearchPage.php | 2 +- .../src/Functional/SearchCommentTest.php | 2 +- .../src/Form/ShortcutSetDeleteForm.php | 2 +- .../shortcut/src/Form/SwitchShortcutSet.php | 2 +- .../migrate/destination/ShortcutSetUsers.php | 2 +- .../src/ShortcutAccessControlHandler.php | 2 +- .../tests/src/Functional/ShortcutSetsTest.php | 2 +- .../system/src/Form/DateFormatFormBase.php | 2 +- .../src/Plugin/Derivative/SystemMenuBlock.php | 2 +- .../Tests/Entity/EntityCacheTagsTestBase.php | 2 +- .../Entity/EntityCacheTagsTestBase.php | 2 +- .../src/Functional/Entity/EntityFormTest.php | 2 +- .../Entity/EntityListBuilderTest.php | 2 +- .../Entity/EntityViewControllerTest.php | 2 +- .../Module/PrepareUninstallTest.php | 2 +- .../Functional/System/TrustedHostsTest.php | 8 +- .../EntityUpdateAddRevisionDefaultTest.php | 8 -- ...dateAddRevisionTranslationAffectedTest.php | 8 -- .../tests/src/Kernel/Action/ActionTest.php | 2 +- ...ityReferenceSelectionReferenceableTest.php | 2 +- .../taxonomy/src/Form/OverviewTerms.php | 4 +- .../taxonomy/src/Form/VocabularyResetForm.php | 2 +- .../Plugin/views/argument/IndexTidDepth.php | 7 +- .../src/Plugin/views/argument/Taxonomy.php | 2 +- .../Plugin/views/argument/VocabularyVid.php | 2 +- .../src/Plugin/views/argument_default/Tid.php | 2 +- .../Plugin/views/field/TaxonomyIndexTid.php | 2 +- .../Plugin/views/filter/TaxonomyIndexTid.php | 4 +- .../views/relationship/NodeTermData.php | 2 +- .../taxonomy/src/TaxonomyPermissions.php | 2 +- core/modules/taxonomy/src/VocabularyForm.php | 2 +- .../TaxonomyTermIndentationTest.php | 2 +- .../tests/src/Functional/TermIndexTest.php | 2 +- .../tests/src/Functional/TermTest.php | 8 +- .../src/Functional/VocabularyCrudTest.php | 2 +- .../tests/src/Functional/VocabularyUiTest.php | 6 +- .../Kernel/Migrate/d6/MigrateTermNodeTest.php | 2 +- .../d6/MigrateTermNodeTranslationTest.php | 2 +- .../tests/src/Kernel/TermKernelTest.php | 4 +- .../tests/src/Functional/TextFieldTest.php | 2 +- core/modules/user/src/AccountSettingsForm.php | 2 +- .../user/src/Controller/UserController.php | 2 +- core/modules/user/src/Form/UserLoginForm.php | 2 +- .../user/src/Form/UserPasswordForm.php | 2 +- .../user/src/Form/UserPermissionsForm.php | 2 +- .../src/Plugin/Action/ChangeUserRoleBase.php | 2 +- .../UserSelection.php | 2 +- .../ProtectedUserFieldConstraintValidator.php | 2 +- .../user/src/Plugin/views/access/Role.php | 2 +- .../src/Plugin/views/argument/RolesRid.php | 7 +- .../user/src/Plugin/views/argument/Uid.php | 8 +- .../src/Plugin/views/field/Permissions.php | 8 +- .../user/src/Plugin/views/filter/Roles.php | 2 +- .../tests/src/Functional/AccessRoleUITest.php | 8 +- .../tests/src/Functional/UserAdminTest.php | 2 +- .../tests/src/Functional/UserCancelTest.php | 30 ++-- .../tests/src/Functional/UserLoginTest.php | 2 +- .../src/Functional/UserPermissionsTest.php | 2 +- .../tests/src/Functional/UserPictureTest.php | 2 +- .../src/Functional/UserRegistrationTest.php | 4 +- .../Functional/UserRolesAssignmentTest.php | 2 +- .../src/Functional/Views/BulkFormTest.php | 2 +- .../src/Kernel/UserAccountFormFieldsTest.php | 4 +- .../user/tests/src/Kernel/UserEntityTest.php | 2 +- .../tests/src/Kernel/UserRoleDeleteTest.php | 2 +- .../src/Kernel/Views/UserKernelTestBase.php | 6 +- .../src/Unit/Views/Argument/RolesRidTest.php | 8 +- .../src/Controller/ViewAjaxController.php | 2 +- .../views/src/Plugin/Block/ViewsBlockBase.php | 2 +- .../src/Plugin/Derivative/ViewsBlock.php | 2 +- .../src/Plugin/Derivative/ViewsEntityRow.php | 2 +- .../Derivative/ViewsExposedFilterBlock.php | 2 +- .../src/Plugin/Derivative/ViewsLocalTask.php | 2 +- .../src/Plugin/Derivative/ViewsMenuLink.php | 2 +- .../ViewsSelection.php | 2 +- .../views/src/Plugin/Menu/ViewsMenuLink.php | 2 +- .../views/src/Plugin/views/area/View.php | 2 +- .../views/src/Plugin/views/display/Block.php | 2 +- .../views/src/Plugin/views/display/Page.php | 2 +- .../views/src/Plugin/views/field/BulkForm.php | 2 +- .../views/src/Plugin/views/field/Date.php | 2 +- .../src/Plugin/views/field/EntityLabel.php | 20 +-- .../views/src/Plugin/views/filter/Bundle.php | 2 +- core/modules/views/src/Views.php | 2 +- .../tests/src/Functional/BulkFormTest.php | 2 +- .../tests/src/Functional/DefaultViewsTest.php | 2 +- .../src/Functional/Plugin/CacheTagTest.php | 6 +- .../Functional/Plugin/DisabledDisplayTest.php | 2 +- .../src/Functional/Plugin/DisplayFeedTest.php | 2 +- .../src/Functional/Plugin/StyleOpmlTest.php | 4 +- .../src/Kernel/Handler/AreaEntityTest.php | 4 +- .../views/tests/src/Kernel/ModuleTest.php | 2 +- .../Plugin/Display/ViewsMenuLinkTest.php | 8 -- .../tests/src/Kernel/QueryGroupByTest.php | 2 +- .../tests/src/Kernel/ViewExecutableTest.php | 2 +- .../tests/src/Kernel/ViewStorageTest.php | 2 +- .../tests/src/Unit/Plugin/area/EntityTest.php | 16 +-- .../views/tests/src/Unit/ViewsTest.php | 6 +- .../tests/src/Functional/GroupByTest.php | 2 +- .../tests/src/Functional/HandlerTest.php | 6 +- .../tests/src/Functional/ViewEditTest.php | 4 +- ...CacheabilityMetadataConfigOverrideTest.php | 6 +- .../Core/Config/ConfigDependencyTest.php | 12 +- .../Core/Config/ConfigEntityUnitTest.php | 2 +- .../Core/Datetime/DateFormatterTest.php | 2 +- .../Entity/BundleConstraintValidatorTest.php | 4 +- .../Entity/EntityAccessControlHandlerTest.php | 2 +- .../EntityTypeConstraintValidatorTest.php | 2 +- .../Core/Entity/EntityViewBuilderTest.php | 18 +-- .../Core/Entity/FieldSqlStorageTest.php | 6 +- .../Entity/EntityDisplayModeBaseUnitTest.php | 15 -- ...ityFormDisplayAccessControlHandlerTest.php | 6 - .../Core/Entity/ContentEntityBaseUnitTest.php | 14 -- .../Core/Entity/EntityFieldManagerTest.php | 14 +- .../Tests/Core/Entity/EntityManagerTest.php | 136 ++++++++++++++++++ .../Core/Entity/EntityTypeBundleInfoTest.php | 2 +- .../Core/Entity/EntityTypeRepositoryTest.php | 2 +- .../Tests/Core/Entity/EntityUrlTest.php | 4 +- .../KeyValueEntityStorageTest.php | 14 -- .../TypedData/EntityAdapterUnitTest.php | 14 -- .../Field/FieldDefinitionListenerTest.php | 16 +-- core/tests/Drupal/Tests/EntityViewTrait.php | 2 +- 263 files changed, 601 insertions(+), 604 deletions(-) diff --git a/core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php b/core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php index 4fe6bc757cd4..f82a9ab802c3 100644 --- a/core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php +++ b/core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php @@ -108,7 +108,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static($configuration, $plugin_id, $plugin_definition, $container->get('token'), - $container->get('entity.manager'), + $container->get('entity_type.manager'), $container->get('logger.factory')->get('action'), $container->get('plugin.manager.mail'), $container->get('language_manager'), diff --git a/core/lib/Drupal/Core/Entity/Controller/EntityViewController.php b/core/lib/Drupal/Core/Entity/Controller/EntityViewController.php index 315a98cbfe31..274c47ad9608 100644 --- a/core/lib/Drupal/Core/Entity/Controller/EntityViewController.php +++ b/core/lib/Drupal/Core/Entity/Controller/EntityViewController.php @@ -24,7 +24,7 @@ class EntityViewController implements ContainerInjectionInterface { /** * The entity type manager. * - * @var \Drupal\Core\Entity\EntityManagerInterface + * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; diff --git a/core/lib/Drupal/Core/Entity/Entity/EntityFormMode.php b/core/lib/Drupal/Core/Entity/Entity/EntityFormMode.php index e5d94a9ebc63..26e6782f081e 100644 --- a/core/lib/Drupal/Core/Entity/Entity/EntityFormMode.php +++ b/core/lib/Drupal/Core/Entity/Entity/EntityFormMode.php @@ -19,8 +19,8 @@ * display settings, or just replicate the settings of the 'default' form mode, * thus reducing the amount of form display configurations to keep track of. * - * @see \Drupal\Core\Entity\EntityManagerInterface::getAllFormModes() - * @see \Drupal\Core\Entity\EntityManagerInterface::getFormModes() + * @see \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getAllFormModes() + * @see \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getFormModes() * * @ConfigEntityType( * id = "entity_form_mode", diff --git a/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManagerInterface.php b/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManagerInterface.php index 6872a1bd1e97..f8b0b6ab2a9c 100644 --- a/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManagerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManagerInterface.php @@ -13,10 +13,11 @@ * perform complex or long-running logic in response to the change. For * example, a SQL-based storage handler may need to update the database schema. * - * To support this, \Drupal\Core\Entity\EntityManagerInterface has methods to - * retrieve the last installed definitions as well as the definitions specified - * by the current codebase. It also has create/update/delete methods to bring - * the former up to date with the latter. + * To support this, + * \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface has methods + * to retrieve the last installed definitions as well as the definitions + * specified by the current codebase. It also has create/update/delete methods + * to bring the former up to date with the latter. * * However, it is not the responsibility of the entity manager to decide how to * report the differences or when to apply each update. This interface is for diff --git a/core/lib/Drupal/Core/Entity/EntityDeleteMultipleAccessCheck.php b/core/lib/Drupal/Core/Entity/EntityDeleteMultipleAccessCheck.php index 6e9564caea2a..cdb70747ef5f 100644 --- a/core/lib/Drupal/Core/Entity/EntityDeleteMultipleAccessCheck.php +++ b/core/lib/Drupal/Core/Entity/EntityDeleteMultipleAccessCheck.php @@ -16,7 +16,7 @@ class EntityDeleteMultipleAccessCheck implements AccessInterface { /** * The entity type manager. * - * @var \Drupal\Core\Entity\EntityManagerInterface + * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index 13f8ccc407aa..14de96e7358a 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -13,9 +13,6 @@ * Deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. We cannot * use the deprecated PHPDoc tag because this service class is still used in * legacy code paths. Symfony would fail test cases with deprecation warnings. - * - * @todo Enforce the deprecation of each method once - * https://www.drupal.org/node/2578361 is in. */ class EntityManager implements EntityManagerInterface, ContainerAwareInterface { @@ -52,6 +49,7 @@ public function clearCachedDefinitions() { * @see https://www.drupal.org/node/2549139 */ public function getDefinition($entity_type_id, $exception_on_invalid = TRUE) { + @trigger_error('EntityManagerInterface::getDefinition() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getDefinition() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED); return $this->container->get('entity_type.manager')->getDefinition($entity_type_id, $exception_on_invalid); } @@ -65,6 +63,7 @@ public function getDefinition($entity_type_id, $exception_on_invalid = TRUE) { * @see https://www.drupal.org/node/2549139 */ public function hasHandler($entity_type_id, $handler_type) { + @trigger_error('EntityManagerInterface::hasHandler() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::hasHandler() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED); return $this->container->get('entity_type.manager')->hasHandler($entity_type_id, $handler_type); } @@ -77,6 +76,7 @@ public function hasHandler($entity_type_id, $handler_type) { * @see https://www.drupal.org/node/2549139 */ public function getStorage($entity_type_id) { + @trigger_error('EntityManagerInterface::getStorage() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getStorage() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED); return $this->container->get('entity_type.manager')->getStorage($entity_type_id); } @@ -90,6 +90,7 @@ public function getStorage($entity_type_id) { * @see https://www.drupal.org/node/2549139 */ public function getListBuilder($entity_type_id) { + @trigger_error('EntityManagerInterface::getListBuilder() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getListBuilder() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED); return $this->container->get('entity_type.manager')->getListBuilder($entity_type_id); } @@ -103,6 +104,7 @@ public function getListBuilder($entity_type_id) { * @see https://www.drupal.org/node/2549139 */ public function getFormObject($entity_type_id, $operation) { + @trigger_error('EntityManagerInterface::getFormObject() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getFormObject() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED); return $this->container->get('entity_type.manager')->getFormObject($entity_type_id, $operation); } @@ -116,6 +118,7 @@ public function getFormObject($entity_type_id, $operation) { * @see https://www.drupal.org/node/2549139 */ public function getRouteProviders($entity_type_id) { + @trigger_error('EntityManagerInterface::getRouteProviders() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getRouteProviders() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED); return $this->container->get('entity_type.manager')->getRouteProviders($entity_type_id); } @@ -129,6 +132,7 @@ public function getRouteProviders($entity_type_id) { * @see https://www.drupal.org/node/2549139 */ public function getViewBuilder($entity_type_id) { + @trigger_error('EntityManagerInterface::getViewBuilder() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getViewBuilder() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED); return $this->container->get('entity_type.manager')->getViewBuilder($entity_type_id); } @@ -142,6 +146,7 @@ public function getViewBuilder($entity_type_id) { * @see https://www.drupal.org/node/2549139 */ public function getAccessControlHandler($entity_type_id) { + @trigger_error('EntityManagerInterface::getAccessControlHandler() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getAccessControlHandler() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED); return $this->container->get('entity_type.manager')->getAccessControlHandler($entity_type_id); } @@ -154,6 +159,7 @@ public function getAccessControlHandler($entity_type_id) { * @see https://www.drupal.org/node/2549139 */ public function getHandler($entity_type_id, $handler_type) { + @trigger_error('EntityManagerInterface::getHandler() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getHandler() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED); return $this->container->get('entity_type.manager')->getHandler($entity_type_id, $handler_type); } @@ -167,6 +173,7 @@ public function getHandler($entity_type_id, $handler_type) { * @see https://www.drupal.org/node/2549139 */ public function createHandlerInstance($class, EntityTypeInterface $definition = NULL) { + @trigger_error('EntityManagerInterface::createHandlerInstance() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::createHandlerInstance() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED); return $this->container->get('entity_type.manager')->createHandlerInstance($class, $definition); } @@ -807,6 +814,7 @@ public function getLastInstalledFieldStorageDefinitions($entity_type_id) { * @see https://www.drupal.org/node/2549139 */ public function getDefinitions() { + @trigger_error('EntityManagerInterface::getDefinitions() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getDefinitions() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED); return $this->container->get('entity_type.manager')->getDefinitions(); } @@ -820,6 +828,7 @@ public function getDefinitions() { * @see https://www.drupal.org/node/2549139 */ public function hasDefinition($plugin_id) { + @trigger_error('EntityManagerInterface::hasDefinition() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::hasDefinition() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED); return $this->container->get('entity_type.manager')->hasDefinition($plugin_id); } diff --git a/core/lib/Drupal/Core/Entity/EntityTypeEvents.php b/core/lib/Drupal/Core/Entity/EntityTypeEvents.php index b6f688a0fcbf..b24ce9b9c3bd 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeEvents.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeEvents.php @@ -17,7 +17,7 @@ final class EntityTypeEvents { * @Event * * @see \Drupal\Core\Entity\EntityTypeEvent - * @see \Drupal\Core\Entity\EntityManager::onEntityTypeCreate() + * @see \Drupal\Core\Entity\EntityTypeListenerInterface::onEntityTypeCreate() * @see \Drupal\Core\Entity\EntityTypeEventSubscriberTrait * @see \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::onEntityTypeCreate() * @@ -35,7 +35,7 @@ final class EntityTypeEvents { * @Event * * @see \Drupal\Core\Entity\EntityTypeEvent - * @see \Drupal\Core\Entity\EntityManager::onEntityTypeUpdate() + * @see \Drupal\Core\Entity\EntityTypeListenerInterface::onEntityTypeUpdate() * @see \Drupal\Core\Entity\EntityTypeEventSubscriberTrait * @see \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::onEntityTypeUpdate() * @@ -53,7 +53,7 @@ final class EntityTypeEvents { * @Event * * @see \Drupal\Core\Entity\EntityTypeEvent - * @see \Drupal\Core\Entity\EntityManager::onEntityTypeDelete() + * @see \Drupal\Core\Entity\EntityTypeListenerInterface::onEntityTypeDelete() * @see \Drupal\Core\Entity\EntityTypeEventSubscriberTrait * @see \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::onEntityTypeDelete() * diff --git a/core/lib/Drupal/Core/Entity/FieldableEntityInterface.php b/core/lib/Drupal/Core/Entity/FieldableEntityInterface.php index d21a2a89ef8e..dc2a6ea1a7fd 100644 --- a/core/lib/Drupal/Core/Entity/FieldableEntityInterface.php +++ b/core/lib/Drupal/Core/Entity/FieldableEntityInterface.php @@ -49,7 +49,7 @@ interface FieldableEntityInterface extends EntityInterface { * An array of base field definitions for the entity type, keyed by field * name. * - * @see \Drupal\Core\Entity\EntityManagerInterface::getFieldDefinitions() + * @see \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldDefinitions() * @see \Drupal\Core\Entity\FieldableEntityInterface::bundleFieldDefinitions() */ public static function baseFieldDefinitions(EntityTypeInterface $entity_type); @@ -85,7 +85,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type); * @return \Drupal\Core\Field\FieldDefinitionInterface[] * An array of bundle field definitions, keyed by field name. * - * @see \Drupal\Core\Entity\EntityManagerInterface::getFieldDefinitions() + * @see \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldDefinitions() * @see \Drupal\Core\Entity\FieldableEntityInterface::baseFieldDefinitions() * * @todo WARNING: This method will be changed in @@ -121,7 +121,7 @@ public function getFieldDefinition($name); * @return \Drupal\Core\Field\FieldDefinitionInterface[] * An array of field definitions, keyed by field name. * - * @see \Drupal\Core\Entity\EntityManagerInterface::getFieldDefinitions() + * @see \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldDefinitions() */ public function getFieldDefinitions(); diff --git a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php index 7d9711e4c00a..9cb8642b7d10 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php +++ b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php @@ -51,7 +51,7 @@ class DefaultSelection extends SelectionPluginBase implements ContainerFactoryPl /** * The entity type manager service. * - * @var \Drupal\Core\Entity\EntityManagerInterface + * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; diff --git a/core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php b/core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php index 1415a1aba66a..1f7fd6d07e94 100644 --- a/core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php +++ b/core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php @@ -33,7 +33,7 @@ class DefaultHtmlRouteProvider implements EntityRouteProviderInterface, EntityHa /** * The entity type manager. * - * @var \Drupal\Core\Entity\EntityManagerInterface + * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; diff --git a/core/lib/Drupal/Core/Entity/entity.api.php b/core/lib/Drupal/Core/Entity/entity.api.php index 74ddd1b4d700..824c894657e5 100644 --- a/core/lib/Drupal/Core/Entity/entity.api.php +++ b/core/lib/Drupal/Core/Entity/entity.api.php @@ -582,7 +582,7 @@ * @code * $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'); + * $view_builder = $container->get('entity_type.manager')->getViewBuilder('your_entity_type'); * @endcode * Then, to build and render the entity: * @code @@ -1940,7 +1940,7 @@ function hook_entity_bundle_field_info_alter(&$fields, \Drupal\Core\Entity\Entit * * @see hook_entity_field_storage_info_alter() * @see \Drupal\Core\Field\FieldStorageDefinitionInterface - * @see \Drupal\Core\Entity\EntityManagerInterface::getFieldStorageDefinitions() + * @see \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldStorageDefinitions() */ function hook_entity_field_storage_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) { if (\Drupal::entityTypeManager()->getStorage($entity_type->id()) instanceof DynamicallyFieldableEntityStorageInterface) { @@ -2176,7 +2176,7 @@ function hook_entity_extra_field_info() { * * @param array $info * The array structure is identical to that of the return value of - * \Drupal\Core\Entity\EntityManagerInterface::getExtraFields(). + * \Drupal\Core\Entity\EntityFieldManagerInterface::getExtraFields(). * * @see hook_entity_extra_field_info() */ diff --git a/core/lib/Drupal/Core/Extension/ModuleUninstallValidatorInterface.php b/core/lib/Drupal/Core/Extension/ModuleUninstallValidatorInterface.php index 022212e82370..94f2d2c7fc3e 100644 --- a/core/lib/Drupal/Core/Extension/ModuleUninstallValidatorInterface.php +++ b/core/lib/Drupal/Core/Extension/ModuleUninstallValidatorInterface.php @@ -17,10 +17,10 @@ interface ModuleUninstallValidatorInterface { * Example implementation: * @code * public function validate($module) { - * $entity_types = $this->entityManager->getDefinitions(); + * $entity_types = $this->entityTypeManager->getDefinitions(); * $reasons = array(); * foreach ($entity_types as $entity_type) { - * if ($module == $entity_type->getProvider() && $entity_type instanceof ContentEntityTypeInterface && $this->entityManager->getStorage($entity_type->id())->hasData()) { + * if ($module == $entity_type->getProvider() && $entity_type instanceof ContentEntityTypeInterface && $this->entityTypeManager->getStorage($entity_type->id())->hasData()) { * $reasons[] = $this->t('There is content for the entity type: @entity_type', array('@entity_type' => $entity_type->getLabel())); * } * } diff --git a/core/lib/Drupal/Core/Field/FieldStorageDefinitionEvents.php b/core/lib/Drupal/Core/Field/FieldStorageDefinitionEvents.php index 661883d851ea..111a27a64688 100644 --- a/core/lib/Drupal/Core/Field/FieldStorageDefinitionEvents.php +++ b/core/lib/Drupal/Core/Field/FieldStorageDefinitionEvents.php @@ -17,7 +17,7 @@ final class FieldStorageDefinitionEvents { * @Event * * @see \Drupal\Core\Field\FieldStorageDefinitionEvent - * @see \Drupal\Core\Entity\EntityManager::onFieldStorageDefinitionCreate() + * @see \Drupal\Core\Field\FieldStorageDefinitionListener::onFieldStorageDefinitionCreate * @see \Drupal\Core\Field\FieldStorageDefinitionEventSubscriberTrait * * @var string @@ -34,7 +34,7 @@ final class FieldStorageDefinitionEvents { * @Event * * @see \Drupal\Core\Field\FieldStorageDefinitionEvent - * @see \Drupal\Core\Entity\EntityManager::onFieldStorageDefinitionUpdate() + * @see \Drupal\Core\Field\FieldStorageDefinitionListener::onFieldStorageDefinitionUpdate() * @see \Drupal\Core\Field\FieldStorageDefinitionEventSubscriberTrait * * @var string @@ -51,7 +51,7 @@ final class FieldStorageDefinitionEvents { * @Event * * @see \Drupal\Core\Field\FieldStorageDefinitionEvent - * @see \Drupal\Core\Entity\EntityManager::onFieldStorageDefinitionDelete() + * @see \Drupal\Core\Field\FieldStorageDefinitionListener::onFieldStorageDefinitionDelete() * @see \Drupal\Core\Field\FieldStorageDefinitionEventSubscriberTrait * * @var string diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php index f73f08340ab2..cbc6d7ddd55a 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php @@ -82,7 +82,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration['view_mode'], $configuration['third_party_settings'], $container->get('date.formatter'), - $container->get('entity.manager')->getStorage('date_format') + $container->get('entity_type.manager')->getStorage('date_format') ); } diff --git a/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php b/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php index 09d866f2882c..70e257642c9f 100644 --- a/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php +++ b/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php @@ -93,7 +93,7 @@ public static function create(ContainerInterface $container) { return new static( $container->get('app.root'), $container->get('site.path'), - $container->get('entity.manager')->getStorage('user'), + $container->get('entity_type.manager')->getStorage('user'), $container->get('state'), $container->get('module_installer'), $container->get('country_manager') diff --git a/core/modules/action/src/Form/ActionFormBase.php b/core/modules/action/src/Form/ActionFormBase.php index 237972ce7e4c..b73ca4c41e00 100644 --- a/core/modules/action/src/Form/ActionFormBase.php +++ b/core/modules/action/src/Form/ActionFormBase.php @@ -42,7 +42,7 @@ public function __construct(EntityStorageInterface $storage) { */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager')->getStorage('action') + $container->get('entity_type.manager')->getStorage('action') ); } diff --git a/core/modules/action/tests/src/Functional/ActionListTest.php b/core/modules/action/tests/src/Functional/ActionListTest.php index 28eda681876c..6bb753e5e7a3 100644 --- a/core/modules/action/tests/src/Functional/ActionListTest.php +++ b/core/modules/action/tests/src/Functional/ActionListTest.php @@ -27,7 +27,7 @@ public function testEmptyActionList() { // Ensure the empty text appears on the action list page. /** @var $storage \Drupal\Core\Entity\EntityStorageInterface */ - $storage = $this->container->get('entity.manager')->getStorage('action'); + $storage = $this->container->get('entity_type.manager')->getStorage('action'); $actions = $storage->loadMultiple(); $storage->delete($actions); $this->drupalGet('/admin/config/system/actions'); diff --git a/core/modules/aggregator/src/Form/OpmlFeedAdd.php b/core/modules/aggregator/src/Form/OpmlFeedAdd.php index 7958f5f7ba95..53573500d7f8 100644 --- a/core/modules/aggregator/src/Form/OpmlFeedAdd.php +++ b/core/modules/aggregator/src/Form/OpmlFeedAdd.php @@ -49,7 +49,7 @@ public function __construct(FeedStorageInterface $feed_storage, ClientInterface */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager')->getStorage('aggregator_feed'), + $container->get('entity_type.manager')->getStorage('aggregator_feed'), $container->get('http_client') ); } diff --git a/core/modules/aggregator/src/Plugin/views/argument/Iid.php b/core/modules/aggregator/src/Plugin/views/argument/Iid.php index 4a51897b2215..9873fe4253d3 100644 --- a/core/modules/aggregator/src/Plugin/views/argument/Iid.php +++ b/core/modules/aggregator/src/Plugin/views/argument/Iid.php @@ -50,7 +50,12 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static($configuration, $plugin_id, $plugin_definition, $container->get('entity.manager')); + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('entity_type.manager') + ); } /** diff --git a/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php b/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php index 4b278d624719..b3f904c12d81 100644 --- a/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php +++ b/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php @@ -69,7 +69,7 @@ public function testOverviewPage() { // Check if the fields in the table match with what's expected. $link = $this->xpath('//table/tbody/tr//td[1]/a'); $this->assertEquals($feed->label(), $link[0]->getText()); - $count = $this->container->get('entity.manager')->getStorage('aggregator_item')->getItemCount($feed); + $count = $this->container->get('entity_type.manager')->getStorage('aggregator_item')->getItemCount($feed); $td = $this->xpath('//table/tbody/tr//td[2]'); $this->assertEquals(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), $td[0]->getText()); @@ -80,7 +80,7 @@ public function testOverviewPage() { // Check if the fields in the table match with what's expected. $link = $this->xpath('//table/tbody/tr//td[1]/a'); $this->assertEquals($feed->label(), $link[0]->getText()); - $count = $this->container->get('entity.manager')->getStorage('aggregator_item')->getItemCount($feed); + $count = $this->container->get('entity_type.manager')->getStorage('aggregator_item')->getItemCount($feed); $td = $this->xpath('//table/tbody/tr//td[2]'); $this->assertEquals(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), $td[0]->getText()); } diff --git a/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php b/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php index 7c7a1fb05063..a5703402ed10 100644 --- a/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php +++ b/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php @@ -55,7 +55,7 @@ public function testBlockLinks() { $this->assertText($block->label(), 'Feed block is displayed on the page.'); // Confirm items appear as links. - $items = $this->container->get('entity.manager')->getStorage('aggregator_item')->loadByFeed($feed->id(), 1); + $items = $this->container->get('entity_type.manager')->getStorage('aggregator_item')->loadByFeed($feed->id(), 1); $links = $this->xpath('//a[@href = :href]', [':href' => reset($items)->getLink()]); $this->assert(isset($links[0]), 'Item link found.'); diff --git a/core/modules/aggregator/tests/src/Functional/DeleteFeedTest.php b/core/modules/aggregator/tests/src/Functional/DeleteFeedTest.php index 7f6a4087f750..67fe2767f097 100644 --- a/core/modules/aggregator/tests/src/Functional/DeleteFeedTest.php +++ b/core/modules/aggregator/tests/src/Functional/DeleteFeedTest.php @@ -34,7 +34,7 @@ public function testDeleteFeed() { // Delete feed. $this->deleteFeed($feed1); $this->assertText($feed2->label()); - $block_storage = $this->container->get('entity.manager')->getStorage('block'); + $block_storage = $this->container->get('entity_type.manager')->getStorage('block'); $this->assertNull($block_storage->load($block->id()), 'Block for the deleted feed was deleted.'); $this->assertEqual($block2->id(), $block_storage->load($block2->id())->id(), 'Block for not deleted feed still exists.'); diff --git a/core/modules/aggregator/tests/src/Kernel/Views/IntegrationTest.php b/core/modules/aggregator/tests/src/Kernel/Views/IntegrationTest.php index 39f57b251889..8094effc798f 100644 --- a/core/modules/aggregator/tests/src/Kernel/Views/IntegrationTest.php +++ b/core/modules/aggregator/tests/src/Kernel/Views/IntegrationTest.php @@ -55,8 +55,8 @@ protected function setUp($import_test_views = TRUE) { ViewTestData::createTestViews(get_class($this), ['aggregator_test_views']); - $this->itemStorage = $this->container->get('entity.manager')->getStorage('aggregator_item'); - $this->feedStorage = $this->container->get('entity.manager')->getStorage('aggregator_feed'); + $this->itemStorage = $this->container->get('entity_type.manager')->getStorage('aggregator_item'); + $this->feedStorage = $this->container->get('entity_type.manager')->getStorage('aggregator_feed'); } /** diff --git a/core/modules/block/src/BlockForm.php b/core/modules/block/src/BlockForm.php index 5dc017fde1f6..5624fc577ef9 100644 --- a/core/modules/block/src/BlockForm.php +++ b/core/modules/block/src/BlockForm.php @@ -110,7 +110,7 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager, Exe */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager'), + $container->get('entity_type.manager'), $container->get('plugin.manager.condition'), $container->get('context.repository'), $container->get('language_manager'), diff --git a/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php b/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php index e95ccd2c7b40..d64c0bddc8a7 100644 --- a/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php +++ b/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php @@ -98,8 +98,8 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_id, $plugin_definition, $container->get('block.repository'), - $container->get('entity.manager')->getViewBuilder('block'), - $container->get('entity.manager')->getDefinition('block')->getListCacheTags() + $container->get('entity_type.manager')->getViewBuilder('block'), + $container->get('entity_type.manager')->getDefinition('block')->getListCacheTags() ); } diff --git a/core/modules/block/src/Plugin/migrate/process/BlockPluginId.php b/core/modules/block/src/Plugin/migrate/process/BlockPluginId.php index 08525674e341..b14ca5506ce7 100644 --- a/core/modules/block/src/Plugin/migrate/process/BlockPluginId.php +++ b/core/modules/block/src/Plugin/migrate/process/BlockPluginId.php @@ -46,7 +46,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { - $entity_manager = $container->get('entity.manager'); + $entity_type_manager = $container->get('entity_type.manager'); $migration_configuration = [ 'migration' => [ 'd6_custom_block', @@ -57,7 +57,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $entity_manager->getDefinition('block_content') ? $entity_manager->getStorage('block_content') : NULL, + $entity_type_manager->getDefinition('block_content') ? $entity_type_manager->getStorage('block_content') : NULL, $container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_configuration, $migration) ); } diff --git a/core/modules/block/tests/src/Unit/BlockFormTest.php b/core/modules/block/tests/src/Unit/BlockFormTest.php index f19f92116786..664ea2e37bf2 100644 --- a/core/modules/block/tests/src/Unit/BlockFormTest.php +++ b/core/modules/block/tests/src/Unit/BlockFormTest.php @@ -44,11 +44,11 @@ class BlockFormTest extends UnitTestCase { protected $themeHandler; /** - * The entity manager. + * The entity type manager. * - * @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $entityManager; + protected $entityTypeManager; /** * The mocked context repository. @@ -74,10 +74,10 @@ protected function setUp() { $this->language = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); $this->contextRepository = $this->getMock('Drupal\Core\Plugin\Context\ContextRepositoryInterface'); - $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface'); + $this->entityTypeManager = $this->getMock('Drupal\Core\Entity\EntityTypeManagerInterface'); $this->storage = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityStorageInterface'); $this->themeHandler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface'); - $this->entityManager->expects($this->any()) + $this->entityTypeManager->expects($this->any()) ->method('getStorage') ->will($this->returnValue($this->storage)); @@ -136,7 +136,7 @@ public function testGetUniqueMachineName() { ->method('getQuery') ->will($this->returnValue($query)); - $block_form_controller = new BlockForm($this->entityManager, $this->conditionManager, $this->contextRepository, $this->language, $this->themeHandler, $this->pluginFormFactory->reveal()); + $block_form_controller = new BlockForm($this->entityTypeManager, $this->conditionManager, $this->contextRepository, $this->language, $this->themeHandler, $this->pluginFormFactory->reveal()); // Ensure that the block with just one other instance gets the next available // name suggestion. diff --git a/core/modules/block_content/src/Controller/BlockContentController.php b/core/modules/block_content/src/Controller/BlockContentController.php index 08408a16b002..5ea0935996ee 100644 --- a/core/modules/block_content/src/Controller/BlockContentController.php +++ b/core/modules/block_content/src/Controller/BlockContentController.php @@ -37,10 +37,10 @@ class BlockContentController extends ControllerBase { * {@inheritdoc} */ public static function create(ContainerInterface $container) { - $entity_manager = $container->get('entity.manager'); + $entity_type_manager = $container->get('entity_type.manager'); return new static( - $entity_manager->getStorage('block_content'), - $entity_manager->getStorage('block_content_type'), + $entity_type_manager->getStorage('block_content'), + $entity_type_manager->getStorage('block_content_type'), $container->get('theme_handler') ); } diff --git a/core/modules/block_content/src/Plugin/Derivative/BlockContent.php b/core/modules/block_content/src/Plugin/Derivative/BlockContent.php index ba1ab989688a..caffc8d9bf07 100644 --- a/core/modules/block_content/src/Plugin/Derivative/BlockContent.php +++ b/core/modules/block_content/src/Plugin/Derivative/BlockContent.php @@ -33,9 +33,9 @@ public function __construct(EntityStorageInterface $block_content_storage) { * {@inheritdoc} */ public static function create(ContainerInterface $container, $base_plugin_id) { - $entity_manager = $container->get('entity.manager'); + $entity_type_manager = $container->get('entity_type.manager'); return new static( - $entity_manager->getStorage('block_content') + $entity_type_manager->getStorage('block_content') ); } diff --git a/core/modules/block_content/tests/src/Functional/BlockContentCacheTagsTest.php b/core/modules/block_content/tests/src/Functional/BlockContentCacheTagsTest.php index ea5dd2873deb..03e0ea3daef3 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentCacheTagsTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentCacheTagsTest.php @@ -71,7 +71,7 @@ protected function getAdditionalCacheTagsForEntity(EntityInterface $entity) { */ public function testBlock() { $block = $this->drupalPlaceBlock('block_content:' . $this->entity->uuid()); - $build = $this->container->get('entity.manager')->getViewBuilder('block')->view($block, 'block'); + $build = $this->container->get('entity_type.manager')->getViewBuilder('block')->view($block, 'block'); // Render the block. // @todo The request stack manipulation won't be necessary once diff --git a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php index 8919c05d0019..556dda69c884 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php @@ -72,7 +72,7 @@ public function testListing() { // Edit the entity using the operations link. $blocks = $this->container - ->get('entity.manager') + ->get('entity_type.manager') ->getStorage('block_content') ->loadByProperties(['info' => $label]); $block = reset($blocks); diff --git a/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php index f9cf29eb77bc..186b32d40881 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php @@ -79,7 +79,7 @@ public function testListing() { // Edit the entity using the operations link. $blocks = $this->container - ->get('entity.manager') + ->get('entity_type.manager') ->getStorage('block_content') ->loadByProperties(['info' => $label]); $block = reset($blocks); diff --git a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php index 6428aed6e48d..d1e662008d88 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php @@ -187,7 +187,7 @@ public function testsBlockContentAddTypes() { // Get the custom block storage. $storage = $this->container - ->get('entity.manager') + ->get('entity_type.manager') ->getStorage('block_content'); // Install all themes. diff --git a/core/modules/book/src/Form/BookAdminEditForm.php b/core/modules/book/src/Form/BookAdminEditForm.php index 8ec9d64a167f..d5d29c1cc82f 100644 --- a/core/modules/book/src/Form/BookAdminEditForm.php +++ b/core/modules/book/src/Form/BookAdminEditForm.php @@ -51,9 +51,9 @@ public function __construct(EntityStorageInterface $node_storage, BookManagerInt * {@inheritdoc} */ public static function create(ContainerInterface $container) { - $entity_manager = $container->get('entity.manager'); + $entity_type_manager = $container->get('entity_type.manager'); return new static( - $entity_manager->getStorage('node'), + $entity_type_manager->getStorage('node'), $container->get('book.manager') ); } diff --git a/core/modules/book/src/Plugin/Block/BookNavigationBlock.php b/core/modules/book/src/Plugin/Block/BookNavigationBlock.php index e55fe365256f..d48568fe3616 100644 --- a/core/modules/book/src/Plugin/Block/BookNavigationBlock.php +++ b/core/modules/book/src/Plugin/Block/BookNavigationBlock.php @@ -78,7 +78,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_definition, $container->get('request_stack'), $container->get('book.manager'), - $container->get('entity.manager')->getStorage('node') + $container->get('entity_type.manager')->getStorage('node') ); } diff --git a/core/modules/book/src/Plugin/views/argument_default/TopLevelBook.php b/core/modules/book/src/Plugin/views/argument_default/TopLevelBook.php index 9ab4fe2904f1..36a6f79a5ca3 100644 --- a/core/modules/book/src/Plugin/views/argument_default/TopLevelBook.php +++ b/core/modules/book/src/Plugin/views/argument_default/TopLevelBook.php @@ -52,7 +52,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_id, $plugin_definition, $container->get('current_route_match'), - $container->get('entity.manager')->getStorage('node') + $container->get('entity_type.manager')->getStorage('node') ); } diff --git a/core/modules/book/tests/src/Functional/BookTest.php b/core/modules/book/tests/src/Functional/BookTest.php index 92dfa00425a2..38fdf54ac5b2 100644 --- a/core/modules/book/tests/src/Functional/BookTest.php +++ b/core/modules/book/tests/src/Functional/BookTest.php @@ -340,7 +340,7 @@ public function testNavigationBlockOnAccessModuleInstalled() { * Tests the access for deleting top-level book nodes. */ public function testBookDelete() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $nodes = $this->createBook(); $this->drupalLogin($this->adminUser); $edit = []; diff --git a/core/modules/book/tests/src/Unit/BookManagerTest.php b/core/modules/book/tests/src/Unit/BookManagerTest.php index 61e665e71c7e..564929fafcba 100644 --- a/core/modules/book/tests/src/Unit/BookManagerTest.php +++ b/core/modules/book/tests/src/Unit/BookManagerTest.php @@ -13,11 +13,11 @@ class BookManagerTest extends UnitTestCase { /** - * The mocked entity manager. + * The mocked entity type manager. * - * @var \Drupal\Core\Entity\EntityManager|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\Entity\EntityTypeManager|\PHPUnit_Framework_MockObject_MockObject */ - protected $entityManager; + protected $entityTypeManager; /** * The mocked config factory. @@ -58,12 +58,12 @@ class BookManagerTest extends UnitTestCase { * {@inheritdoc} */ protected function setUp() { - $this->entityManager = $this->createMock(EntityTypeManagerInterface::class); + $this->entityTypeManager = $this->createMock(EntityTypeManagerInterface::class); $this->translation = $this->getStringTranslationStub(); $this->configFactory = $this->getConfigFactoryStub([]); $this->bookOutlineStorage = $this->getMock('Drupal\book\BookOutlineStorageInterface'); $this->renderer = $this->getMock('\Drupal\Core\Render\RendererInterface'); - $this->bookManager = new BookManager($this->entityManager, $this->translation, $this->configFactory, $this->bookOutlineStorage, $this->renderer); + $this->bookManager = new BookManager($this->entityTypeManager, $this->translation, $this->configFactory, $this->bookOutlineStorage, $this->renderer); } /** diff --git a/core/modules/color/src/Plugin/migrate/source/d7/Color.php b/core/modules/color/src/Plugin/migrate/source/d7/Color.php index 94f0867f245e..ba86df205ba5 100644 --- a/core/modules/color/src/Plugin/migrate/source/d7/Color.php +++ b/core/modules/color/src/Plugin/migrate/source/d7/Color.php @@ -52,7 +52,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_definition, $migration, $container->get('state'), - $container->get('entity.manager'), + $container->get('entity_type.manager'), $container->get('theme_handler') ); } diff --git a/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php b/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php index fe2f7ed5b0d6..f02aa3386653 100644 --- a/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php +++ b/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php @@ -65,7 +65,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager')->getViewBuilder('comment'), + $container->get('entity_type.manager')->getViewBuilder('comment'), $container->get('renderer') ); } diff --git a/core/modules/comment/src/Plugin/Menu/LocalTask/UnapprovedComments.php b/core/modules/comment/src/Plugin/Menu/LocalTask/UnapprovedComments.php index e946bfb9f8ac..f5c6ce7b3f01 100644 --- a/core/modules/comment/src/Plugin/Menu/LocalTask/UnapprovedComments.php +++ b/core/modules/comment/src/Plugin/Menu/LocalTask/UnapprovedComments.php @@ -47,7 +47,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager')->getStorage('comment') + $container->get('entity_type.manager')->getStorage('comment') ); } diff --git a/core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraintValidator.php b/core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraintValidator.php index ebc1a9d03f5d..70d756f22d20 100644 --- a/core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraintValidator.php +++ b/core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraintValidator.php @@ -42,7 +42,7 @@ public function __construct(UserStorageInterface $user_storage) { * {@inheritdoc} */ public static function create(ContainerInterface $container) { - return new static($container->get('entity.manager')->getStorage('user')); + return new static($container->get('entity_type.manager')->getStorage('user')); } /** diff --git a/core/modules/comment/tests/src/Functional/CommentStatisticsTest.php b/core/modules/comment/tests/src/Functional/CommentStatisticsTest.php index 4a0eae08790f..57b7ce24011d 100644 --- a/core/modules/comment/tests/src/Functional/CommentStatisticsTest.php +++ b/core/modules/comment/tests/src/Functional/CommentStatisticsTest.php @@ -39,7 +39,7 @@ protected function setUp() { * Tests the node comment statistics. */ public function testCommentNodeCommentStatistics() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); // Set comments to have subject and preview disabled. $this->drupalLogin($this->adminUser); $this->setCommentPreview(DRUPAL_DISABLED); diff --git a/core/modules/comment/tests/src/Kernel/Views/CommentViewsKernelTestBase.php b/core/modules/comment/tests/src/Kernel/Views/CommentViewsKernelTestBase.php index 516750382caf..e9c3f57a1655 100644 --- a/core/modules/comment/tests/src/Kernel/Views/CommentViewsKernelTestBase.php +++ b/core/modules/comment/tests/src/Kernel/Views/CommentViewsKernelTestBase.php @@ -48,9 +48,9 @@ protected function setUp($import_test_views = TRUE) { $this->installEntitySchema('comment'); $this->installConfig(['user']); - $entity_manager = $this->container->get('entity.manager'); - $this->commentStorage = $entity_manager->getStorage('comment'); - $this->userStorage = $entity_manager->getStorage('user'); + $entity_type_manager = $this->container->get('entity_type.manager'); + $this->commentStorage = $entity_type_manager->getStorage('comment'); + $this->userStorage = $entity_type_manager->getStorage('user'); // Insert a row for the anonymous user. $this->userStorage diff --git a/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php b/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php index f8569d0d7949..ea8f0d634334 100644 --- a/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php +++ b/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php @@ -33,7 +33,7 @@ public function testConfigDependencyDeleteFormTrait() { $this->drupalLogin($this->drupalCreateUser(['administer site configuration'])); /** @var \Drupal\Core\Config\Entity\ConfigEntityStorage $storage */ - $storage = $this->container->get('entity.manager')->getStorage('config_test'); + $storage = $this->container->get('entity_type.manager')->getStorage('config_test'); // Entity1 will be deleted by the test. $entity1 = $storage->create( [ diff --git a/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php b/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php index a4dc92c78aa6..fde14c7cfba8 100644 --- a/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php @@ -26,7 +26,7 @@ public function testFormsWithOverrides() { $overridden_label = 'Overridden label'; $edited_label = 'Edited label'; - $config_test_storage = $this->container->get('entity.manager')->getStorage('config_test'); + $config_test_storage = $this->container->get('entity_type.manager')->getStorage('config_test'); // Set up an override. $settings['config']['config_test.dynamic.dotted.default']['label'] = (object) [ diff --git a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php index 16fcc89dd642..8018f136e4b1 100644 --- a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php @@ -121,7 +121,7 @@ public function testList() { // Test that config entities that do not support status, do not have // enable/disable operations. - $controller = $this->container->get('entity.manager') + $controller = $this->container->get('entity_type.manager') ->getListBuilder('config_test_no_status'); $list = $controller->load(); diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php index e4aae1a6bced..ec90074d7101 100644 --- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php +++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php @@ -148,7 +148,7 @@ public function testListingPageWithOverrides() { $original_label = 'Default'; $overridden_label = 'Overridden label'; - $config_test_storage = $this->container->get('entity.manager')->getStorage('config_test'); + $config_test_storage = $this->container->get('entity_type.manager')->getStorage('config_test'); // Set up an override. $settings['config']['config_test.dynamic.dotted.default']['label'] = (object) [ diff --git a/core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php b/core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php index 5a4f9d9a42ee..918ab1c1966c 100644 --- a/core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php +++ b/core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php @@ -22,11 +22,11 @@ class ConfigEntityMapperTest extends UnitTestCase { protected $configEntityMapper; /** - * The entity manager used for testing. + * The entity type manager used for testing. * - * @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $entityManager; + protected $entityTypeManager; /** * The entity instance used for testing. @@ -57,7 +57,7 @@ class ConfigEntityMapperTest extends UnitTestCase { protected $eventDispatcher; protected function setUp() { - $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface'); + $this->entityTypeManager = $this->getMock('Drupal\Core\Entity\EntityTypeManagerInterface'); $this->entity = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityInterface'); @@ -97,7 +97,7 @@ protected function setUp() { $this->getMock('Drupal\config_translation\ConfigMapperManagerInterface'), $this->routeProvider, $this->getStringTranslationStub(), - $this->entityManager, + $this->entityTypeManager, $this->languageManager, $this->eventDispatcher ); @@ -118,7 +118,7 @@ public function testEntityGetterAndSetter() { ->expects($this->any()) ->method('getConfigPrefix') ->will($this->returnValue('config_prefix')); - $this->entityManager + $this->entityTypeManager ->expects($this->once()) ->method('getDefinition') ->with('configurable_language') @@ -147,7 +147,7 @@ public function testEntityGetterAndSetter() { */ public function testGetOverviewRouteParameters() { $entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface'); - $this->entityManager + $this->entityTypeManager ->expects($this->once()) ->method('getDefinition') ->with('configurable_language') @@ -181,7 +181,7 @@ public function testGetTypeName() { $entity_type->expects($this->once()) ->method('getLabel') ->will($this->returnValue('test')); - $this->entityManager + $this->entityTypeManager ->expects($this->once()) ->method('getDefinition') ->with('configurable_language') @@ -199,7 +199,7 @@ public function testGetTypeLabel() { $entity_type->expects($this->once()) ->method('getLabel') ->will($this->returnValue('test')); - $this->entityManager + $this->entityTypeManager ->expects($this->once()) ->method('getDefinition') ->with('configurable_language') diff --git a/core/modules/config_translation/tests/src/Unit/ConfigFieldMapperTest.php b/core/modules/config_translation/tests/src/Unit/ConfigFieldMapperTest.php index 3d17e4641e25..86e5216d9a06 100644 --- a/core/modules/config_translation/tests/src/Unit/ConfigFieldMapperTest.php +++ b/core/modules/config_translation/tests/src/Unit/ConfigFieldMapperTest.php @@ -29,11 +29,11 @@ class ConfigFieldMapperTest extends UnitTestCase { protected $entity; /** - * The entity manager used for testing. + * The entity type manager used for testing. * - * @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $entityManager; + protected $entityTypeManager; /** * The mocked event dispatcher. @@ -46,7 +46,7 @@ class ConfigFieldMapperTest extends UnitTestCase { * {@inheritdoc} */ protected function setUp() { - $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface'); + $this->entityTypeManager = $this->getMock('Drupal\Core\Entity\EntityTypeManagerInterface'); $this->entity = $this->getMock('Drupal\field\FieldConfigInterface'); $definition = [ @@ -72,7 +72,7 @@ protected function setUp() { $this->getMock('Drupal\config_translation\ConfigMapperManagerInterface'), $this->getMock('Drupal\Core\Routing\RouteProviderInterface'), $this->getStringTranslationStub(), - $this->entityManager, + $this->entityTypeManager, $this->getMock('Drupal\Core\Language\LanguageManagerInterface'), $this->eventDispatcher ); @@ -90,7 +90,7 @@ public function testSetEntity() { ->method('getConfigPrefix') ->will($this->returnValue('config_prefix')); - $this->entityManager + $this->entityTypeManager ->expects($this->any()) ->method('getDefinition') ->will($this->returnValue($entity_type)); diff --git a/core/modules/contact/tests/src/Kernel/MessageEntityTest.php b/core/modules/contact/tests/src/Kernel/MessageEntityTest.php index f3025e7b1ced..4299e5e4a0ee 100644 --- a/core/modules/contact/tests/src/Kernel/MessageEntityTest.php +++ b/core/modules/contact/tests/src/Kernel/MessageEntityTest.php @@ -34,7 +34,7 @@ protected function setUp() { * Test some of the methods. */ public function testMessageMethods() { - $message_storage = $this->container->get('entity.manager')->getStorage('contact_message'); + $message_storage = $this->container->get('entity_type.manager')->getStorage('contact_message'); $message = $message_storage->create(['contact_form' => 'feedback']); // Check for empty values first. diff --git a/core/modules/content_translation/src/ContentTranslationPermissions.php b/core/modules/content_translation/src/ContentTranslationPermissions.php index a47f2247fcca..b2dcb6394e29 100644 --- a/core/modules/content_translation/src/ContentTranslationPermissions.php +++ b/core/modules/content_translation/src/ContentTranslationPermissions.php @@ -25,7 +25,7 @@ class ContentTranslationPermissions implements ContainerInjectionInterface { /** * The entity type manager. * - * @var \Drupal\Core\Entity\EntityManagerInterface + * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; diff --git a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php index d7f18c4c766b..479c4af9cbf7 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php @@ -228,7 +228,7 @@ protected function createEntity($values, $langcode, $bundle_name = NULL) { if ($bundle_key = $entity_type->getKey('bundle')) { $entity_values[$bundle_key] = $bundle_name ?: $this->bundle; } - $controller = $this->container->get('entity.manager')->getStorage($this->entityTypeId); + $controller = $this->container->get('entity_type.manager')->getStorage($this->entityTypeId); if (!($controller instanceof SqlContentEntityStorage)) { foreach ($values as $property => $value) { if (is_array($value)) { diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php index 9d72977899f7..5d0f179b67dd 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php @@ -285,14 +285,4 @@ public function testNonTranslatableTranslationSettingsUI() { $this->assertNoField('settings[entity_test][entity_test][translatable]'); } - /** - * Returns the entity manager. - * - * @return \Drupal\Core\Entity\EntityManagerInterface - * The entity manager; - */ - protected function entityManager() { - return $this->container->get('entity.manager'); - } - } diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php index 7451e17dbad0..65bb9aef3dde 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php @@ -222,8 +222,8 @@ protected function createEntity($values, $langcode, $bundle_name = NULL) { if ($bundle_key = $entity_type->getKey('bundle')) { $entity_values[$bundle_key] = $bundle_name ?: $this->bundle; } - $controller = $this->container->get('entity.manager')->getStorage($this->entityTypeId); - if (!($controller instanceof SqlContentEntityStorage)) { + $storage = $this->container->get('entity_type.manager')->getStorage($this->entityTypeId); + if (!($storage instanceof SqlContentEntityStorage)) { foreach ($values as $property => $value) { if (is_array($value)) { $entity_values[$property] = [$langcode => $value]; diff --git a/core/modules/content_translation/tests/src/Functional/Update/ContentTranslationUpdateTest.php b/core/modules/content_translation/tests/src/Functional/Update/ContentTranslationUpdateTest.php index 54f1bd14f09a..3df89e96fef7 100644 --- a/core/modules/content_translation/tests/src/Functional/Update/ContentTranslationUpdateTest.php +++ b/core/modules/content_translation/tests/src/Functional/Update/ContentTranslationUpdateTest.php @@ -30,13 +30,6 @@ class ContentTranslationUpdateTest extends UpdatePathTestBase { */ protected $entityDefinitionUpdateManager; - /** - * The entity manager service. - * - * @var \Drupal\Core\Entity\EntityManagerInterface - */ - protected $entityManager; - /** * The state service. * @@ -52,7 +45,6 @@ protected function setUp() { $this->database = \Drupal::database(); $this->entityDefinitionUpdateManager = \Drupal::entityDefinitionUpdateManager(); - $this->entityManager = \Drupal::entityManager(); $this->state = \Drupal::state(); } diff --git a/core/modules/content_translation/tests/src/Kernel/ContentTranslationConfigImportTest.php b/core/modules/content_translation/tests/src/Kernel/ContentTranslationConfigImportTest.php index 6cbfe597acf9..7e0d99faa95e 100644 --- a/core/modules/content_translation/tests/src/Kernel/ContentTranslationConfigImportTest.php +++ b/core/modules/content_translation/tests/src/Kernel/ContentTranslationConfigImportTest.php @@ -96,7 +96,7 @@ public function testConfigImportUpdates() { $this->assertIdentical($config->get('id'), $config_id); // Verify that updates were performed. - $entity_type = $this->container->get('entity.manager')->getDefinition($entity_type_id); + $entity_type = $this->container->get('entity_type.manager')->getDefinition($entity_type_id); $table = $entity_type->getDataTable(); $db_schema = $this->container->get('database')->schema(); $result = $db_schema->fieldExists($table, 'content_translation_source') && $db_schema->fieldExists($table, 'content_translation_outdated'); diff --git a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php index a6680f6b4d3e..a4fe711b8a39 100644 --- a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php +++ b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php @@ -75,7 +75,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration['view_mode'], $configuration['third_party_settings'], $container->get('date.formatter'), - $container->get('entity.manager')->getStorage('date_format') + $container->get('entity_type.manager')->getStorage('date_format') ); } diff --git a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php index 2a4ffcd29750..4b4e95a11103 100644 --- a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php +++ b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php @@ -49,7 +49,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration['field_definition'], $configuration['settings'], $configuration['third_party_settings'], - $container->get('entity.manager')->getStorage('date_format') + $container->get('entity_type.manager')->getStorage('date_format') ); } diff --git a/core/modules/editor/src/Form/EditorImageDialog.php b/core/modules/editor/src/Form/EditorImageDialog.php index b31055e39f09..c125e499a543 100644 --- a/core/modules/editor/src/Form/EditorImageDialog.php +++ b/core/modules/editor/src/Form/EditorImageDialog.php @@ -43,7 +43,7 @@ public function __construct(EntityStorageInterface $file_storage) { */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager')->getStorage('file') + $container->get('entity_type.manager')->getStorage('file') ); } diff --git a/core/modules/editor/tests/src/Unit/EditorConfigEntityUnitTest.php b/core/modules/editor/tests/src/Unit/EditorConfigEntityUnitTest.php index e40e349a7425..45ebe3788248 100644 --- a/core/modules/editor/tests/src/Unit/EditorConfigEntityUnitTest.php +++ b/core/modules/editor/tests/src/Unit/EditorConfigEntityUnitTest.php @@ -3,7 +3,6 @@ namespace Drupal\Tests\editor\Unit; use Drupal\Core\DependencyInjection\ContainerBuilder; -use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\editor\Entity\Editor; use Drupal\Tests\UnitTestCase; @@ -80,16 +79,10 @@ protected function setUp() { ->disableOriginalConstructor() ->getMock(); - $entity_manager = new EntityManager(); - $container = new ContainerBuilder(); - $container->set('entity.manager', $entity_manager); $container->set('entity_type.manager', $this->entityTypeManager); $container->set('uuid', $this->uuid); $container->set('plugin.manager.editor', $this->editorPluginManager); - // Inject the container into entity.manager so it can defer to - // entity_type.manager. - $entity_manager->setContainer($container); \Drupal::setContainer($container); } diff --git a/core/modules/field/src/FieldConfigStorage.php b/core/modules/field/src/FieldConfigStorage.php index d9f545b68cd3..f8a7f4a9cd2d 100644 --- a/core/modules/field/src/FieldConfigStorage.php +++ b/core/modules/field/src/FieldConfigStorage.php @@ -83,7 +83,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI $container->get('config.factory'), $container->get('uuid'), $container->get('language_manager'), - $container->get('entity.manager'), + $container->get('entity_type.manager'), $container->get('plugin.manager.field.field_type'), $container->get('entity_field.deleted_fields_repository'), $container->get('entity.memory_cache') diff --git a/core/modules/field/src/FieldStorageConfigStorage.php b/core/modules/field/src/FieldStorageConfigStorage.php index dab6c6990b31..5dbbef0a3d04 100644 --- a/core/modules/field/src/FieldStorageConfigStorage.php +++ b/core/modules/field/src/FieldStorageConfigStorage.php @@ -94,7 +94,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI $container->get('config.factory'), $container->get('uuid'), $container->get('language_manager'), - $container->get('entity.manager'), + $container->get('entity_type.manager'), $container->get('module_handler'), $container->get('plugin.manager.field.field_type'), $container->get('entity_field.deleted_fields_repository'), diff --git a/core/modules/field/tests/src/Functional/FormTest.php b/core/modules/field/tests/src/Functional/FormTest.php index 5522e0205f95..91da759d6766 100644 --- a/core/modules/field/tests/src/Functional/FormTest.php +++ b/core/modules/field/tests/src/Functional/FormTest.php @@ -150,7 +150,7 @@ public function testFieldFormSingle() { ]; $this->drupalPostForm(NULL, $edit, t('Save')); $this->assertText(t('entity_test @id has been updated.', ['@id' => $id]), 'Entity was updated'); - $this->container->get('entity.manager')->getStorage('entity_test')->resetCache([$id]); + $this->container->get('entity_type.manager')->getStorage('entity_test')->resetCache([$id]); $entity = EntityTest::load($id); $this->assertEqual($entity->{$field_name}->value, $value, 'Field value was updated'); @@ -161,7 +161,7 @@ public function testFieldFormSingle() { ]; $this->drupalPostForm('entity_test/manage/' . $id . '/edit', $edit, t('Save')); $this->assertText(t('entity_test @id has been updated.', ['@id' => $id]), 'Entity was updated'); - $this->container->get('entity.manager')->getStorage('entity_test')->resetCache([$id]); + $this->container->get('entity_type.manager')->getStorage('entity_test')->resetCache([$id]); $entity = EntityTest::load($id); $this->assertTrue($entity->{$field_name}->isEmpty(), 'Field was emptied'); } diff --git a/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php b/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php index a8b087461d89..2c444e6a49cf 100644 --- a/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php +++ b/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php @@ -203,7 +203,7 @@ public function testEntityCache() { $this->assertFalse(\Drupal::cache('entity')->get($cid), 'Cached: no cache entry on insert'); // Load, and check that a cache entry is present with the expected values. - $controller = $this->container->get('entity.manager')->getStorage($entity->getEntityTypeId()); + $controller = $this->container->get('entity_type.manager')->getStorage($entity->getEntityTypeId()); $controller->resetCache(); $cached_entity = $controller->load($entity->id()); $cache = \Drupal::cache('entity')->get($cid); diff --git a/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php b/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php index 7aa6359c7f7b..cc08edb348b6 100644 --- a/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php +++ b/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php @@ -46,7 +46,7 @@ public function testFieldAttachSaveLoad() { $values[$current_revision] = $current_values; } - $storage = $this->container->get('entity.manager')->getStorage($entity_type); + $storage = $this->container->get('entity_type.manager')->getStorage($entity_type); $storage->resetCache(); $entity = $storage->load($entity_id); // Confirm current revision loads the correct data. @@ -249,7 +249,7 @@ public function testFieldAttachDelete() { $entity->setNewRevision(); $entity->save(); $vids[] = $entity->getRevisionId(); - $controller = $this->container->get('entity.manager')->getStorage($entity->getEntityTypeId()); + $controller = $this->container->get('entity_type.manager')->getStorage($entity->getEntityTypeId()); $controller->resetCache(); // Confirm each revision loads @@ -361,7 +361,7 @@ public function testEntityDeleteBundle() { entity_test_delete_bundle($this->fieldTestData->field->getTargetBundle(), $entity_type); // Verify no data gets loaded - $controller = $this->container->get('entity.manager')->getStorage($entity->getEntityTypeId()); + $controller = $this->container->get('entity_type.manager')->getStorage($entity->getEntityTypeId()); $controller->resetCache(); $entity = $controller->load($entity->id()); diff --git a/core/modules/field/tests/src/Kernel/FieldCrudTest.php b/core/modules/field/tests/src/Kernel/FieldCrudTest.php index 14eebec8f8d8..33c94e29d03e 100644 --- a/core/modules/field/tests/src/Kernel/FieldCrudTest.php +++ b/core/modules/field/tests/src/Kernel/FieldCrudTest.php @@ -337,7 +337,7 @@ public function testDeleteFieldCrossDeletion() { $field->save(); $field_2 = FieldConfig::create($field_definition_2); $field_2->save(); - $this->container->get('entity.manager')->getStorage('field_config')->delete([$field, $field_2]); + $this->container->get('entity_type.manager')->getStorage('field_config')->delete([$field, $field_2]); $this->assertFalse(FieldStorageConfig::loadByName('entity_test', $field_storage->getName())); } diff --git a/core/modules/field/tests/src/Kernel/FieldDataCountTest.php b/core/modules/field/tests/src/Kernel/FieldDataCountTest.php index 3224763293f0..86cb4150e499 100644 --- a/core/modules/field/tests/src/Kernel/FieldDataCountTest.php +++ b/core/modules/field/tests/src/Kernel/FieldDataCountTest.php @@ -136,7 +136,7 @@ public function testEntityCountAndHasData() { $this->assertIdentical($this->fieldTestData->field_storage_2->hasData(), TRUE, 'There are entities with field data.'); - $storage = $this->container->get('entity.manager')->getStorage($entity_type); + $storage = $this->container->get('entity_type.manager')->getStorage($entity_type); $entity = $storage->loadRevision($first_revision); $this->assertEqual(count($entity->{$this->fieldTestData->field_name_2}), $cardinality, format_string('Revision %revision_id: expected number of values.', ['%revision_id' => $first_revision])); } diff --git a/core/modules/field/tests/src/Kernel/FieldKernelTestBase.php b/core/modules/field/tests/src/Kernel/FieldKernelTestBase.php index 92dd7d7a31db..568f62cda3de 100644 --- a/core/modules/field/tests/src/Kernel/FieldKernelTestBase.php +++ b/core/modules/field/tests/src/Kernel/FieldKernelTestBase.php @@ -129,7 +129,7 @@ protected function createFieldWithStorage($suffix = '', $entity_type = 'entity_t */ protected function entitySaveReload(EntityInterface $entity) { $entity->save(); - $controller = $this->container->get('entity.manager')->getStorage($entity->getEntityTypeId()); + $controller = $this->container->get('entity_type.manager')->getStorage($entity->getEntityTypeId()); $controller->resetCache(); return $controller->load($entity->id()); } diff --git a/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php b/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php index 10c0a7d9f5a6..6d41f2d03e05 100644 --- a/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php +++ b/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php @@ -11,7 +11,6 @@ use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\Entity\EntityFieldManagerInterface; -use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\field\Entity\FieldConfig; use Drupal\Tests\UnitTestCase; @@ -32,13 +31,6 @@ class FieldConfigEntityUnitTest extends UnitTestCase { /** * The entity manager used for testing. * - * @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $entityManager; - - /** - * The entity type manager used for testing. - * * @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $entityTypeManager; @@ -85,7 +77,6 @@ protected function setUp() { $this->entityTypeId = $this->randomMachineName(); $this->entityType = $this->getMock('\Drupal\Core\Config\Entity\ConfigEntityTypeInterface'); - $this->entityManager = new EntityManager(); $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class); $this->entityFieldManager = $this->getMock(EntityFieldManagerInterface::class); @@ -94,14 +85,10 @@ protected function setUp() { $this->fieldTypePluginManager = $this->getMock('Drupal\Core\Field\FieldTypePluginManagerInterface'); $container = new ContainerBuilder(); - $container->set('entity.manager', $this->entityManager); $container->set('entity_field.manager', $this->entityFieldManager); $container->set('entity_type.manager', $this->entityTypeManager); $container->set('uuid', $this->uuid); $container->set('plugin.manager.field.field_type', $this->fieldTypePluginManager); - // Inject the container into entity.manager so it can defer to - // entity_type.manager, etc. - $this->entityManager->setContainer($container); \Drupal::setContainer($container); // Create a mock FieldStorageConfig object. diff --git a/core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php b/core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php index 83abd3cad61e..9c6a8408fbce 100644 --- a/core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php +++ b/core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php @@ -6,7 +6,6 @@ use Drupal\Core\Cache\Context\CacheContextsManager; use Drupal\Core\Config\Entity\ConfigEntityTypeInterface; use Drupal\Core\DependencyInjection\Container; -use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -141,16 +140,10 @@ protected function setUp() { ['field_storage_config', $storage_access_control_handler], ]); - $entity_manager = new EntityManager(); - $container = new Container(); - $container->set('entity.manager', $entity_manager); $container->set('entity_type.manager', $entity_type_manager); $container->set('uuid', $this->getMock(UuidInterface::class)); $container->set('cache_contexts_manager', $this->prophesize(CacheContextsManager::class)); - // Inject the container into entity.manager so it can defer to - // entity_type.manager. - $entity_manager->setContainer($container); \Drupal::setContainer($container); $this->entity = new FieldStorageConfig([ diff --git a/core/modules/field/tests/src/Unit/FieldStorageConfigEntityUnitTest.php b/core/modules/field/tests/src/Unit/FieldStorageConfigEntityUnitTest.php index 970532a3e802..bed4eb9bc070 100644 --- a/core/modules/field/tests/src/Unit/FieldStorageConfigEntityUnitTest.php +++ b/core/modules/field/tests/src/Unit/FieldStorageConfigEntityUnitTest.php @@ -8,7 +8,6 @@ namespace Drupal\Tests\field\Unit; use Drupal\Core\DependencyInjection\ContainerBuilder; -use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Field\FieldException; use Drupal\Core\Field\FieldStorageDefinitionInterface; @@ -55,19 +54,14 @@ class FieldStorageConfigEntityUnitTest extends UnitTestCase { * {@inheritdoc} */ protected function setUp() { - $entity_manager = new EntityManager(); $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class); $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface'); $this->fieldTypeManager = $this->getMock(FieldTypePluginManagerInterface::class); $container = new ContainerBuilder(); - $container->set('entity.manager', $entity_manager); $container->set('entity_type.manager', $this->entityTypeManager); $container->set('uuid', $this->uuid); $container->set('plugin.manager.field.field_type', $this->fieldTypeManager); - // Inject the container into entity.manager so it can defer to - // entity_type.manager. - $entity_manager->setContainer($container); \Drupal::setContainer($container); } diff --git a/core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php b/core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php index ccb968a542bf..404e6ed33e89 100644 --- a/core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php +++ b/core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php @@ -28,11 +28,6 @@ class ManageDisplayTest extends WebDriverTestBase { */ protected $type; - /** - * @var \Drupal\Core\Entity\EntityManagerInterface - */ - protected $entity_manager; - /** * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ @@ -60,7 +55,6 @@ protected function setUp() { $this->type = $type->id(); $this->entity_type_manager = $this->container->get('entity_type.manager'); - $this->entity_manager = $this->container->get('entity.manager'); } /** diff --git a/core/modules/file/src/Tests/FileFieldTestBase.php b/core/modules/file/src/Tests/FileFieldTestBase.php index 9bc7dc9949a6..484bf2fa0222 100644 --- a/core/modules/file/src/Tests/FileFieldTestBase.php +++ b/core/modules/file/src/Tests/FileFieldTestBase.php @@ -197,7 +197,7 @@ public function uploadNodeFiles(array $files, $field_name, $nid_or_type, $new_re 'revision' => (string) (int) $new_revision, ]; - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); if (is_numeric($nid_or_type)) { $nid = $nid_or_type; $node_storage->resetCache([$nid]); @@ -277,7 +277,7 @@ public function assertFileExists($file, $message = NULL) { * Asserts that a file exists in the database. */ public function assertFileEntryExists($file, $message = NULL) { - $this->container->get('entity.manager')->getStorage('file')->resetCache(); + $this->container->get('entity_type.manager')->getStorage('file')->resetCache(); $db_file = File::load($file->id()); $message = isset($message) ? $message : format_string('File %file exists in database at the correct path.', ['%file' => $file->getFileUri()]); $this->assertEqual($db_file->getFileUri(), $file->getFileUri(), $message); @@ -295,7 +295,7 @@ public function assertFileNotExists($file, $message = NULL) { * Asserts that a file does not exist in the database. */ public function assertFileEntryNotExists($file, $message) { - $this->container->get('entity.manager')->getStorage('file')->resetCache(); + $this->container->get('entity_type.manager')->getStorage('file')->resetCache(); $message = isset($message) ? $message : format_string('File %file exists in database at the correct path.', ['%file' => $file->getFileUri()]); $this->assertFalse(File::load($file->id()), $message); } diff --git a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php index 68fe7d263b7a..15130fdae539 100644 --- a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php @@ -65,7 +65,7 @@ public function testNodeDisplay() { $nid = $this->uploadNodeFile($test_file, $field_name, $type_name); // Check that the default formatter is displaying with the file name. - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $node_storage->resetCache([$nid]); $node = $node_storage->load($nid); $node_file = File::load($node->{$field_name}->target_id); diff --git a/core/modules/file/tests/src/Functional/FileFieldPathTest.php b/core/modules/file/tests/src/Functional/FileFieldPathTest.php index f664fb7b6c10..1a909f308ff9 100644 --- a/core/modules/file/tests/src/Functional/FileFieldPathTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldPathTest.php @@ -16,7 +16,7 @@ class FileFieldPathTest extends FileFieldTestBase { */ public function testUploadPath() { /** @var \Drupal\node\NodeStorageInterface $node_storage */ - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $field_name = strtolower($this->randomMachineName()); $type_name = 'article'; $this->createFileField($field_name, 'node', $type_name); diff --git a/core/modules/file/tests/src/Functional/FileFieldRSSContentTest.php b/core/modules/file/tests/src/Functional/FileFieldRSSContentTest.php index 26d14dbfb498..57d2fd2363a4 100644 --- a/core/modules/file/tests/src/Functional/FileFieldRSSContentTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldRSSContentTest.php @@ -22,7 +22,7 @@ class FileFieldRSSContentTest extends FileFieldTestBase { * Tests RSS enclosure formatter display for RSS feeds. */ public function testFileFieldRSSContent() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $field_name = strtolower($this->randomMachineName()); $type_name = 'article'; diff --git a/core/modules/file/tests/src/Functional/FileFieldRevisionTest.php b/core/modules/file/tests/src/Functional/FileFieldRevisionTest.php index 332afc9ea7ed..37e2ff5b96ea 100644 --- a/core/modules/file/tests/src/Functional/FileFieldRevisionTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldRevisionTest.php @@ -29,7 +29,7 @@ public function testRevisions() { $this->config('file.settings') ->set('make_unused_managed_files_temporary', TRUE) ->save(); - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $type_name = 'article'; $field_name = strtolower($this->randomMachineName()); $this->createFileField($field_name, 'node', $type_name); diff --git a/core/modules/file/tests/src/Functional/FileFieldTestBase.php b/core/modules/file/tests/src/Functional/FileFieldTestBase.php index 6ae309400eee..cfee3bd697d7 100644 --- a/core/modules/file/tests/src/Functional/FileFieldTestBase.php +++ b/core/modules/file/tests/src/Functional/FileFieldTestBase.php @@ -126,7 +126,7 @@ public function uploadNodeFiles(array $files, $field_name, $nid_or_type, $new_re 'revision' => (string) (int) $new_revision, ]; - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); if (is_numeric($nid_or_type)) { $nid = $nid_or_type; $node_storage->resetCache([$nid]); @@ -220,7 +220,7 @@ public static function assertFileExists($file, $message = NULL) { * Asserts that a file exists in the database. */ public function assertFileEntryExists($file, $message = NULL) { - $this->container->get('entity.manager')->getStorage('file')->resetCache(); + $this->container->get('entity_type.manager')->getStorage('file')->resetCache(); $db_file = File::load($file->id()); $message = isset($message) ? $message : format_string('File %file exists in database at the correct path.', ['%file' => $file->getFileUri()]); $this->assertEqual($db_file->getFileUri(), $file->getFileUri(), $message); @@ -247,7 +247,7 @@ public static function assertFileNotExists($file, $message = NULL) { * Asserts that a file does not exist in the database. */ public function assertFileEntryNotExists($file, $message) { - $this->container->get('entity.manager')->getStorage('file')->resetCache(); + $this->container->get('entity_type.manager')->getStorage('file')->resetCache(); $message = isset($message) ? $message : format_string('File %file exists in database at the correct path.', ['%file' => $file->getFileUri()]); $this->assertFalse(File::load($file->id()), $message); } diff --git a/core/modules/file/tests/src/Functional/FileFieldValidateTest.php b/core/modules/file/tests/src/Functional/FileFieldValidateTest.php index c307ce0fb2b2..21f2a8ba89c7 100644 --- a/core/modules/file/tests/src/Functional/FileFieldValidateTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldValidateTest.php @@ -18,7 +18,7 @@ class FileFieldValidateTest extends FileFieldTestBase { * Tests the required property on file fields. */ public function testRequired() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $type_name = 'article'; $field_name = strtolower($this->randomMachineName()); $storage = $this->createFileField($field_name, 'node', $type_name, [], ['required' => '1']); @@ -66,7 +66,7 @@ public function testRequired() { * Tests the max file size validator. */ public function testFileMaxSize() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $type_name = 'article'; $field_name = strtolower($this->randomMachineName()); $this->createFileField($field_name, 'node', $type_name, [], ['required' => '1']); @@ -117,7 +117,7 @@ public function testFileMaxSize() { * Tests file extension checking. */ public function testFileExtension() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $type_name = 'article'; $field_name = strtolower($this->randomMachineName()); $this->createFileField($field_name, 'node', $type_name); @@ -160,7 +160,7 @@ public function testFileExtension() { * Checks that a file can always be removed if it does not pass validation. */ public function testFileRemoval() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $type_name = 'article'; $field_name = 'file_test'; $this->createFileField($field_name, 'node', $type_name); diff --git a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php index 9d20859c0b35..f072f8d5a522 100644 --- a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php @@ -113,7 +113,7 @@ public function testSingleValuedWidget() { * Tests upload and remove buttons for multiple multi-valued File fields. */ public function testMultiValuedWidget() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $type_name = 'article'; // Use explicit names instead of random names for those fields, because of a // bug in drupalPostForm() with multiple file uploads in one form, where the @@ -239,7 +239,7 @@ public function testMultiValuedWidget() { * Tests a file field with a "Private files" upload destination setting. */ public function testPrivateFileSetting() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); // Grant the admin user required permissions. user_role_grant_permissions($this->adminUser->roles[0]->target_id, ['administer node fields']); diff --git a/core/modules/file/tests/src/Functional/FilePrivateTest.php b/core/modules/file/tests/src/Functional/FilePrivateTest.php index 7a6824b1323e..4b699ef43693 100644 --- a/core/modules/file/tests/src/Functional/FilePrivateTest.php +++ b/core/modules/file/tests/src/Functional/FilePrivateTest.php @@ -37,7 +37,7 @@ protected function setUp() { * Tests file access for file uploaded to a private node. */ public function testPrivateFile() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); /** @var \Drupal\Core\File\FileSystemInterface $file_system */ $file_system = \Drupal::service('file_system'); $type_name = 'article'; @@ -139,7 +139,7 @@ public function testPrivateFile() { $edit = ['files[' . $field_name . '_0]' => $file_system->realpath($test_file->getFileUri())]; $this->drupalPostForm(NULL, $edit, t('Upload')); /** @var \Drupal\file\FileStorageInterface $file_storage */ - $file_storage = $this->container->get('entity.manager')->getStorage('file'); + $file_storage = $this->container->get('entity_type.manager')->getStorage('file'); $files = $file_storage->loadByProperties(['uid' => 0]); $this->assertEqual(1, count($files), 'Loaded one anonymous file.'); $file = end($files); diff --git a/core/modules/file/tests/src/Functional/FileTokenReplaceTest.php b/core/modules/file/tests/src/Functional/FileTokenReplaceTest.php index 689b1206b43d..3f8ad074271d 100644 --- a/core/modules/file/tests/src/Functional/FileTokenReplaceTest.php +++ b/core/modules/file/tests/src/Functional/FileTokenReplaceTest.php @@ -18,7 +18,7 @@ class FileTokenReplaceTest extends FileFieldTestBase { * Creates a file, then tests the tokens generated from it. */ public function testFileTokenReplacement() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $token_service = \Drupal::token(); $language_interface = \Drupal::languageManager()->getCurrentLanguage(); /** @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */ diff --git a/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateUploadTest.php b/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateUploadTest.php index 338d757c6ebc..0d9981ab1e4c 100644 --- a/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateUploadTest.php +++ b/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateUploadTest.php @@ -69,7 +69,7 @@ protected function setUp() { * Test upload migration from Drupal 6 to Drupal 8. */ public function testUpload() { - $this->container->get('entity.manager') + $this->container->get('entity_type.manager') ->getStorage('node') ->resetCache([1, 2, 12]); diff --git a/core/modules/file/tests/src/Kernel/SpaceUsedTest.php b/core/modules/file/tests/src/Kernel/SpaceUsedTest.php index fd5c90cac5ed..634f4e57aafa 100644 --- a/core/modules/file/tests/src/Kernel/SpaceUsedTest.php +++ b/core/modules/file/tests/src/Kernel/SpaceUsedTest.php @@ -55,7 +55,7 @@ protected function createFileWithSize($uri, $size, $uid, $status = FILE_STATUS_P * Test different users with the default status. */ public function testFileSpaceUsed() { - $file = $this->container->get('entity.manager')->getStorage('file'); + $file = $this->container->get('entity_type.manager')->getStorage('file'); // Test different users with default status. $this->assertEqual($file->spaceUsed(2), 70); $this->assertEqual($file->spaceUsed(3), 300); diff --git a/core/modules/filter/src/FilterPermissions.php b/core/modules/filter/src/FilterPermissions.php index ea9b0aeeb995..b7e33d68ab1a 100644 --- a/core/modules/filter/src/FilterPermissions.php +++ b/core/modules/filter/src/FilterPermissions.php @@ -42,7 +42,7 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager) { * {@inheritdoc} */ public static function create(ContainerInterface $container) { - return new static($container->get('entity.manager')); + return new static($container->get('entity_type.manager')); } /** diff --git a/core/modules/forum/tests/src/Functional/Views/ForumIntegrationTest.php b/core/modules/forum/tests/src/Functional/Views/ForumIntegrationTest.php index 992500e1f9d5..838bee047cab 100644 --- a/core/modules/forum/tests/src/Functional/Views/ForumIntegrationTest.php +++ b/core/modules/forum/tests/src/Functional/Views/ForumIntegrationTest.php @@ -39,11 +39,11 @@ protected function setUp($import_test_views = TRUE) { */ public function testForumIntegration() { // Create a forum. - $entity_manager = $this->container->get('entity.manager'); - $term = $entity_manager->getStorage('taxonomy_term')->create(['vid' => 'forums', 'name' => $this->randomMachineName()]); + $entity_type_manager = $this->container->get('entity_type.manager'); + $term = $entity_type_manager->getStorage('taxonomy_term')->create(['vid' => 'forums', 'name' => $this->randomMachineName()]); $term->save(); - $comment_storage = $entity_manager->getStorage('comment'); + $comment_storage = $entity_type_manager->getStorage('comment'); // Create some nodes which are part of this forum with some comments. $nodes = []; diff --git a/core/modules/image/src/Form/ImageStyleEditForm.php b/core/modules/image/src/Form/ImageStyleEditForm.php index c166bb8fb035..f33c20b87004 100644 --- a/core/modules/image/src/Form/ImageStyleEditForm.php +++ b/core/modules/image/src/Form/ImageStyleEditForm.php @@ -42,7 +42,7 @@ public function __construct(EntityStorageInterface $image_style_storage, ImageEf */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager')->getStorage('image_style'), + $container->get('entity_type.manager')->getStorage('image_style'), $container->get('plugin.manager.image.effect') ); } diff --git a/core/modules/image/src/Form/ImageStyleFormBase.php b/core/modules/image/src/Form/ImageStyleFormBase.php index e446f69afefa..166faa8f64b4 100644 --- a/core/modules/image/src/Form/ImageStyleFormBase.php +++ b/core/modules/image/src/Form/ImageStyleFormBase.php @@ -41,7 +41,7 @@ public function __construct(EntityStorageInterface $image_style_storage) { */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager')->getStorage('image_style') + $container->get('entity_type.manager')->getStorage('image_style') ); } diff --git a/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php index b48f0d14aa56..ee99b0f87b59 100644 --- a/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php +++ b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php @@ -85,7 +85,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration['view_mode'], $configuration['third_party_settings'], $container->get('current_user'), - $container->get('entity.manager')->getStorage('image_style') + $container->get('entity_type.manager')->getStorage('image_style') ); } diff --git a/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php b/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php index 37fa04c7937a..7be3c6fc6801 100644 --- a/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php +++ b/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php @@ -35,7 +35,7 @@ class ImageFieldDefaultImagesTest extends ImageFieldTestBase { * Tests CRUD for fields and field storages with default images. */ public function testDefaultImages() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); // Create files to use as the default images. $files = $this->drupalGetTestFiles('image'); // Create 10 files so the default image fids are not a single value. diff --git a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php index f0f5ed52e48b..6c3d80d2ecbe 100644 --- a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php +++ b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php @@ -54,7 +54,7 @@ public function testImageFieldFormattersPrivate() { public function _testImageFieldFormatters($scheme) { /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = $this->container->get('renderer'); - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $field_name = strtolower($this->randomMachineName()); $field_settings = ['alt_field_required' => 0]; $instance = $this->createImageField($field_name, 'article', ['uri_scheme' => $scheme], $field_settings); @@ -230,7 +230,7 @@ public function _testImageFieldFormatters($scheme) { public function testImageFieldSettings() { /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = $this->container->get('renderer'); - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $test_image = current($this->drupalGetTestFiles('image')); list(, $test_image_extension) = explode('.', $test_image->filename); $field_name = strtolower($this->randomMachineName()); @@ -349,7 +349,7 @@ public function testImageFieldDefaultImage() { /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = $this->container->get('renderer'); - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); // Create a new image field. $field_name = strtolower($this->randomMachineName()); $this->createImageField($field_name, 'article'); diff --git a/core/modules/image/tests/src/Kernel/ImageStyleIntegrationTest.php b/core/modules/image/tests/src/Kernel/ImageStyleIntegrationTest.php index 74fa6431b5d3..a37fa3235850 100644 --- a/core/modules/image/tests/src/Kernel/ImageStyleIntegrationTest.php +++ b/core/modules/image/tests/src/Kernel/ImageStyleIntegrationTest.php @@ -88,7 +88,7 @@ public function testEntityDisplayDependency() { // of selecting a replacement style by setting the replacement image style // ID in the image style storage. /** @var \Drupal\image\ImageStyleStorageInterface $storage */ - $storage = $this->container->get('entity.manager')->getStorage($style->getEntityTypeId()); + $storage = $this->container->get('entity_type.manager')->getStorage($style->getEntityTypeId()); $storage->setReplacementId('main_style', 'replacement_style'); $style->delete(); diff --git a/core/modules/image/tests/src/Unit/ImageStyleTest.php b/core/modules/image/tests/src/Unit/ImageStyleTest.php index bc954b3cc46b..14fd135f1136 100644 --- a/core/modules/image/tests/src/Unit/ImageStyleTest.php +++ b/core/modules/image/tests/src/Unit/ImageStyleTest.php @@ -20,11 +20,11 @@ class ImageStyleTest extends UnitTestCase { protected $entityType; /** - * The entity manager used for testing. + * The entity type manager used for testing. * - * @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $entityManager; + protected $entityTypeManager; /** * The ID of the type of the entity under test. @@ -92,8 +92,8 @@ protected function setUp() { $this->entityType->expects($this->any()) ->method('getProvider') ->will($this->returnValue($this->provider)); - $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface'); - $this->entityManager->expects($this->any()) + $this->entityTypeManager = $this->getMock('\Drupal\Core\Entity\EntityTypeManagerInterface'); + $this->entityTypeManager->expects($this->any()) ->method('getDefinition') ->with($this->entityTypeId) ->will($this->returnValue($this->entityType)); diff --git a/core/modules/language/src/Form/NegotiationConfigureForm.php b/core/modules/language/src/Form/NegotiationConfigureForm.php index 0b22bc70a496..0679a563d21e 100644 --- a/core/modules/language/src/Form/NegotiationConfigureForm.php +++ b/core/modules/language/src/Form/NegotiationConfigureForm.php @@ -93,8 +93,8 @@ public function __construct(ConfigFactoryInterface $config_factory, Configurable * {@inheritdoc} */ public static function create(ContainerInterface $container) { - $entity_manager = $container->get('entity.manager'); - $block_storage = $entity_manager->hasHandler('block', 'storage') ? $entity_manager->getStorage('block') : NULL; + $entity_type_manager = $container->get('entity_type.manager'); + $block_storage = $entity_type_manager->hasHandler('block', 'storage') ? $entity_type_manager->getStorage('block') : NULL; return new static( $container->get('config.factory'), $container->get('language_manager'), diff --git a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php index e99a4013584b..d028444797e3 100644 --- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php +++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php @@ -90,7 +90,7 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager) { * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static($container->get('entity.manager')); + return new static($container->get('entity_type.manager')); } /** diff --git a/core/modules/language/tests/src/Kernel/EntityDefaultLanguageTest.php b/core/modules/language/tests/src/Kernel/EntityDefaultLanguageTest.php index 88abdd9006dd..06047dfaf027 100644 --- a/core/modules/language/tests/src/Kernel/EntityDefaultLanguageTest.php +++ b/core/modules/language/tests/src/Kernel/EntityDefaultLanguageTest.php @@ -29,7 +29,7 @@ protected function setUp() { $this->installEntitySchema('user'); // Activate Spanish language, so there are two languages activated. - $language = $this->container->get('entity.manager')->getStorage('configurable_language')->create([ + $language = $this->container->get('entity_type.manager')->getStorage('configurable_language')->create([ 'id' => 'es', ]); $language->save(); @@ -101,7 +101,7 @@ public function testEntityTranslationDefaultLanguageViaCode() { * Default language code of the nodes of this type. */ protected function createContentType($name, $langcode) { - $content_type = $this->container->get('entity.manager')->getStorage('node_type')->create([ + $content_type = $this->container->get('entity_type.manager')->getStorage('node_type')->create([ 'name' => 'Test ' . $name, 'title_label' => 'Title', 'type' => $name, @@ -134,7 +134,7 @@ protected function createNode($type, $langcode = NULL) { if (!empty($langcode)) { $values['langcode'] = $langcode; } - $node = $this->container->get('entity.manager')->getStorage('node')->create($values); + $node = $this->container->get('entity_type.manager')->getStorage('node')->create($values); return $node; } diff --git a/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php b/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php index c3955df56a9e..b366406d7ce6 100644 --- a/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php +++ b/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php @@ -4,7 +4,6 @@ use Drupal\Core\Language\LanguageInterface; use Drupal\Core\DependencyInjection\ContainerBuilder; -use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\EntityTypeRepositoryInterface; use Drupal\language\Entity\ContentLanguageSettings; @@ -23,13 +22,6 @@ class ContentLanguageSettingsUnitTest extends UnitTestCase { */ protected $entityType; - /** - * The entity manager used for testing. - * - * @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $entityManager; - /** * The entity type manager used for testing. * @@ -72,7 +64,6 @@ protected function setUp() { $this->entityTypeId = $this->randomMachineName(); $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface'); - $this->entityManager = new EntityManager(); $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class); $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface'); @@ -82,14 +73,10 @@ protected function setUp() { $this->configEntityStorageInterface = $this->getMock('Drupal\Core\Entity\EntityStorageInterface'); $container = new ContainerBuilder(); - $container->set('entity.manager', $this->entityManager); $container->set('entity_type.manager', $this->entityTypeManager); $container->set('uuid', $this->uuid); $container->set('config.typed', $this->typedConfigManager); $container->set('config.storage', $this->configEntityStorageInterface); - // Inject the container into entity.manager so it can defer to other entity - // services. - $this->entityManager->setContainer($container); \Drupal::setContainer($container); } diff --git a/core/modules/layout_builder/tests/src/Unit/DefaultsSectionStorageTest.php b/core/modules/layout_builder/tests/src/Unit/DefaultsSectionStorageTest.php index f36b8fbc94b1..5281d08d7a60 100644 --- a/core/modules/layout_builder/tests/src/Unit/DefaultsSectionStorageTest.php +++ b/core/modules/layout_builder/tests/src/Unit/DefaultsSectionStorageTest.php @@ -32,9 +32,9 @@ class DefaultsSectionStorageTest extends UnitTestCase { protected $plugin; /** - * The entity manager. + * The entity type manager. * - * @var \Drupal\Core\Entity\EntityManagerInterface + * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; diff --git a/core/modules/link/tests/src/Functional/LinkFieldTest.php b/core/modules/link/tests/src/Functional/LinkFieldTest.php index 5035e749038c..14a758a216c3 100644 --- a/core/modules/link/tests/src/Functional/LinkFieldTest.php +++ b/core/modules/link/tests/src/Functional/LinkFieldTest.php @@ -668,7 +668,7 @@ public function testLinkTypeOnLinkWidget() { ], ])->save(); - $this->container->get('entity.manager') + $this->container->get('entity_type.manager') ->getStorage('entity_form_display') ->load('entity_test.entity_test.default') ->setComponent($field_name, [ @@ -823,7 +823,7 @@ public function testNoLinkUri() { */ protected function renderTestEntity($id, $view_mode = 'full', $reset = TRUE) { if ($reset) { - $this->container->get('entity.manager')->getStorage('entity_test')->resetCache([$id]); + $this->container->get('entity_type.manager')->getStorage('entity_test')->resetCache([$id]); } $entity = EntityTest::load($id); $display = \Drupal::service('entity_display.repository') diff --git a/core/modules/media/tests/src/Functional/MediaRevisionTest.php b/core/modules/media/tests/src/Functional/MediaRevisionTest.php index 8291d2fcfd02..89f7125ec8b3 100644 --- a/core/modules/media/tests/src/Functional/MediaRevisionTest.php +++ b/core/modules/media/tests/src/Functional/MediaRevisionTest.php @@ -22,7 +22,7 @@ public function testRevisions() { $assert = $this->assertSession(); /** @var \Drupal\Core\Entity\Sql\SqlContentEntityStorage $media_storage */ - $media_storage = $this->container->get('entity.manager')->getStorage('media'); + $media_storage = $this->container->get('entity_type.manager')->getStorage('media'); // Create a media type and media item. $media_type = $this->createMediaType('test'); diff --git a/core/modules/migrate/src/Plugin/Derivative/MigrateEntity.php b/core/modules/migrate/src/Plugin/Derivative/MigrateEntity.php index 0babe2fc7432..862882d232d2 100644 --- a/core/modules/migrate/src/Plugin/Derivative/MigrateEntity.php +++ b/core/modules/migrate/src/Plugin/Derivative/MigrateEntity.php @@ -36,7 +36,7 @@ public function __construct(array $entity_definitions) { */ public static function create(ContainerInterface $container, $base_plugin_id) { return new static( - $container->get('entity.manager')->getDefinitions() + $container->get('entity_type.manager')->getDefinitions() ); } diff --git a/core/modules/migrate/src/Plugin/Derivative/MigrateEntityRevision.php b/core/modules/migrate/src/Plugin/Derivative/MigrateEntityRevision.php index cee3b3985ed0..99bb6530bf7a 100644 --- a/core/modules/migrate/src/Plugin/Derivative/MigrateEntityRevision.php +++ b/core/modules/migrate/src/Plugin/Derivative/MigrateEntityRevision.php @@ -36,7 +36,7 @@ public function __construct(array $entity_definitions) { */ public static function create(ContainerInterface $container, $base_plugin_id) { return new static( - $container->get('entity.manager')->getDefinitions() + $container->get('entity_type.manager')->getDefinitions() ); } diff --git a/core/modules/migrate/src/Plugin/migrate/destination/Entity.php b/core/modules/migrate/src/Plugin/migrate/destination/Entity.php index a3b173f8d0cd..7e6f9ebf9aee 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/Entity.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/Entity.php @@ -114,7 +114,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_id, $plugin_definition, $migration, - $container->get('entity.manager')->getStorage($entity_type_id), + $container->get('entity_type.manager')->getStorage($entity_type_id), array_keys($container->get('entity_type.bundle.info')->getBundleInfo($entity_type_id)) ); } diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityConfigBase.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityConfigBase.php index 868ad1a83f9d..5ae0904cd11b 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/EntityConfigBase.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityConfigBase.php @@ -112,7 +112,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_id, $plugin_definition, $migration, - $container->get('entity.manager')->getStorage($entity_type_id), + $container->get('entity_type.manager')->getStorage($entity_type_id), array_keys($container->get('entity_type.bundle.info')->getBundleInfo($entity_type_id)), $container->get('language_manager'), $container->get('config.factory') diff --git a/core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php b/core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php index 2d33e3abe329..82399c0a683d 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php +++ b/core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php @@ -59,7 +59,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_definition, $container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_configuration, $migration), $container->get('plugin.manager.menu.link'), - $container->get('entity.manager')->getStorage('menu_link_content') + $container->get('entity_type.manager')->getStorage('menu_link_content') ); } diff --git a/core/modules/migrate/tests/src/Kernel/MigrateEntityContentBaseTest.php b/core/modules/migrate/tests/src/Kernel/MigrateEntityContentBaseTest.php index 13ec353ee55d..6ac145e61077 100644 --- a/core/modules/migrate/tests/src/Kernel/MigrateEntityContentBaseTest.php +++ b/core/modules/migrate/tests/src/Kernel/MigrateEntityContentBaseTest.php @@ -55,7 +55,7 @@ protected function setUp() { ConfigurableLanguage::createFromLangcode('en')->save(); ConfigurableLanguage::createFromLangcode('fr')->save(); - $this->storage = $this->container->get('entity.manager')->getStorage('entity_test_mul'); + $this->storage = $this->container->get('entity_type.manager')->getStorage('entity_test_mul'); } /** diff --git a/core/modules/migrate/tests/src/Kernel/MigrateExternalTranslatedTest.php b/core/modules/migrate/tests/src/Kernel/MigrateExternalTranslatedTest.php index d9728f587e0a..ea45a78fca7b 100644 --- a/core/modules/migrate/tests/src/Kernel/MigrateExternalTranslatedTest.php +++ b/core/modules/migrate/tests/src/Kernel/MigrateExternalTranslatedTest.php @@ -48,7 +48,7 @@ public function setUp() { */ public function testMigrations() { /** @var \Drupal\Core\Entity\ContentEntityStorageInterface $storage */ - $storage = $this->container->get('entity.manager')->getStorage('node'); + $storage = $this->container->get('entity_type.manager')->getStorage('node'); $this->assertEquals(0, count($storage->loadMultiple())); // Run the migrations. diff --git a/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php b/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php index f6ed26666f83..219a13f17f11 100644 --- a/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php +++ b/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php @@ -34,9 +34,9 @@ class EntityRevisionTest extends UnitTestCase { protected $storage; /** - * @var \Drupal\Core\Entity\EntityManagerInterface + * @var \Drupal\Core\Entity\EntityFieldManagerInterface */ - protected $entityManager; + protected $entityFieldManager; /** * @var \Drupal\Core\Field\FieldTypePluginManagerInterface @@ -55,7 +55,7 @@ protected function setUp() { $entity_type->getPluralLabel()->willReturn('craziness'); $this->storage->getEntityType()->willReturn($entity_type->reveal()); - $this->entityManager = $this->prophesize('\Drupal\Core\Entity\EntityManagerInterface'); + $this->entityFieldManager = $this->prophesize('\Drupal\Core\Entity\EntityFieldManagerInterface'); $this->fieldTypeManager = $this->prophesize('\Drupal\Core\Field\FieldTypePluginManagerInterface'); } @@ -193,7 +193,7 @@ protected function getEntityRevisionDestination(array $configuration = [], $plug $this->migration->reveal(), $this->storage->reveal(), [], - $this->entityManager->reveal(), + $this->entityFieldManager->reveal(), $this->fieldTypeManager->reveal() ); } diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/destination/EntityFieldStorageConfig.php b/core/modules/migrate_drupal/src/Plugin/migrate/destination/EntityFieldStorageConfig.php index 3e51f459979f..cdc63decde6b 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/destination/EntityFieldStorageConfig.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/destination/EntityFieldStorageConfig.php @@ -71,7 +71,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_id, $plugin_definition, $migration, - $container->get('entity.manager')->getStorage($entity_type_id), + $container->get('entity_type.manager')->getStorage($entity_type_id), array_keys($container->get('entity_type.bundle.info')->getBundleInfo($entity_type_id)), $container->get('language_manager'), $container->get('config.factory'), diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php index 1e402f3dcec2..38b4cbe3abcf 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php @@ -101,7 +101,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_definition, $migration, $container->get('state'), - $container->get('entity.manager') + $container->get('entity_type.manager') ); } diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/D6VariableTranslation.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/D6VariableTranslation.php index a4a3a9f085c7..8433ec7131d2 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/D6VariableTranslation.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/D6VariableTranslation.php @@ -2,7 +2,7 @@ namespace Drupal\migrate_drupal\Plugin\migrate\source\d6; -use Drupal\Core\Entity\EntityManagerInterface; +use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\State\StateInterface; use Drupal\migrate\Plugin\MigrationInterface; @@ -24,9 +24,9 @@ class D6VariableTranslation extends VariableTranslation { /** * {@inheritdoc} */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityTypeManagerInterface $entity_type_manager) { @trigger_error('The ' . __NAMESPACE__ . '\D6VariableTranslation is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Instead, use ' . __NAMESPACE__ . '\VariableTranslation. See https://www.drupal.org/node/3006487.', E_USER_DEPRECATED); - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager); + parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_type_manager); } } diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php index fdaf4b10af7c..c4df5ba71ccc 100644 --- a/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php +++ b/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php @@ -46,9 +46,9 @@ public function testSourceProviderNotActive() { $plugin_definition['source_module'] = 'module1'; /** @var \Drupal\Core\State\StateInterface $state */ $state = $this->getMock('Drupal\Core\State\StateInterface'); - /** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */ - $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface'); - $plugin = new TestDrupalSqlBase([], 'placeholder_id', $plugin_definition, $this->getMigration(), $state, $entity_manager); + /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */ + $entity_type_manager = $this->getMock('Drupal\Core\Entity\EntityTypeManagerInterface'); + $plugin = new TestDrupalSqlBase([], 'placeholder_id', $plugin_definition, $this->getMigration(), $state, $entity_type_manager); $plugin->setDatabase($this->getDatabase($this->databaseContents)); $system_data = $plugin->getSystemData(); $this->setExpectedException(RequirementsException::class, 'The module module1 is not enabled in the source site.'); @@ -71,8 +71,8 @@ public function testSourceDatabaseError() { $plugin_definition['source_module'] = 'module1'; /** @var \Drupal\Core\State\StateInterface $state */ $state = $this->getMock('Drupal\Core\State\StateInterface'); - /** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */ - $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface'); + /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_manager */ + $entity_manager = $this->getMock('Drupal\Core\Entity\EntityTypeManagerInterface'); $plugin = new TestDrupalSqlBase([], 'test', $plugin_definition, $this->getMigration(), $state, $entity_manager); $system_data = $plugin->getSystemData(); $this->setExpectedException(RequirementsException::class, 'No database connection configured for source plugin test'); diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php index e8866d6f1043..5469ae18150c 100644 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php +++ b/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php @@ -70,9 +70,9 @@ protected function setUp() { $plugin = 'placeholder_id'; /** @var \Drupal\Core\State\StateInterface $state */ $state = $this->getMock('Drupal\Core\State\StateInterface'); - /** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */ - $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface'); - $this->base = new TestDrupal6SqlBase($this->migrationConfiguration, $plugin, [], $this->getMigration(), $state, $entity_manager); + /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */ + $entity_type_manager = $this->getMock('Drupal\Core\Entity\EntityTypeManagerInterface'); + $this->base = new TestDrupal6SqlBase($this->migrationConfiguration, $plugin, [], $this->getMigration(), $state, $entity_type_manager); $this->base->setDatabase($this->getDatabase($this->databaseContents)); } diff --git a/core/modules/node/src/Form/NodeRevisionDeleteForm.php b/core/modules/node/src/Form/NodeRevisionDeleteForm.php index d73dfd5c0fb4..aefefde6cd27 100644 --- a/core/modules/node/src/Form/NodeRevisionDeleteForm.php +++ b/core/modules/node/src/Form/NodeRevisionDeleteForm.php @@ -75,10 +75,10 @@ public function __construct(EntityStorageInterface $node_storage, EntityStorageI * {@inheritdoc} */ public static function create(ContainerInterface $container) { - $entity_manager = $container->get('entity.manager'); + $entity_type_manager = $container->get('entity_type.manager'); return new static( - $entity_manager->getStorage('node'), - $entity_manager->getStorage('node_type'), + $entity_type_manager->getStorage('node'), + $entity_type_manager->getStorage('node_type'), $container->get('database'), $container->get('date.formatter') ); diff --git a/core/modules/node/src/Form/NodeRevisionRevertForm.php b/core/modules/node/src/Form/NodeRevisionRevertForm.php index cbd7e868ff02..da5cba023c15 100644 --- a/core/modules/node/src/Form/NodeRevisionRevertForm.php +++ b/core/modules/node/src/Form/NodeRevisionRevertForm.php @@ -67,7 +67,7 @@ public function __construct(EntityStorageInterface $node_storage, DateFormatterI */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager')->getStorage('node'), + $container->get('entity_type.manager')->getStorage('node'), $container->get('date.formatter'), $container->get('datetime.time') ); diff --git a/core/modules/node/src/Form/NodeRevisionRevertTranslationForm.php b/core/modules/node/src/Form/NodeRevisionRevertTranslationForm.php index a6a4d85d8af5..c4f78c312553 100644 --- a/core/modules/node/src/Form/NodeRevisionRevertTranslationForm.php +++ b/core/modules/node/src/Form/NodeRevisionRevertTranslationForm.php @@ -53,7 +53,7 @@ public function __construct(EntityStorageInterface $node_storage, DateFormatterI */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager')->getStorage('node'), + $container->get('entity_type.manager')->getStorage('node'), $container->get('date.formatter'), $container->get('language_manager'), $container->get('datetime.time') diff --git a/core/modules/node/src/Plugin/Condition/NodeType.php b/core/modules/node/src/Plugin/Condition/NodeType.php index 93e18c09ae24..ba8726d53742 100644 --- a/core/modules/node/src/Plugin/Condition/NodeType.php +++ b/core/modules/node/src/Plugin/Condition/NodeType.php @@ -53,7 +53,7 @@ public function __construct(EntityStorageInterface $entity_storage, array $confi */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( - $container->get('entity.manager')->getStorage('node_type'), + $container->get('entity_type.manager')->getStorage('node_type'), $configuration, $plugin_id, $plugin_definition diff --git a/core/modules/node/src/Plugin/migrate/source/d6/Node.php b/core/modules/node/src/Plugin/migrate/source/d6/Node.php index f5eb9cc64bd8..215a73c8a236 100644 --- a/core/modules/node/src/Plugin/migrate/source/d6/Node.php +++ b/core/modules/node/src/Plugin/migrate/source/d6/Node.php @@ -66,7 +66,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_definition, $migration, $container->get('state'), - $container->get('entity.manager'), + $container->get('entity_type.manager'), $container->get('module_handler') ); } diff --git a/core/modules/node/src/Plugin/migrate/source/d6/ViewMode.php b/core/modules/node/src/Plugin/migrate/source/d6/ViewMode.php index 434007a0a20a..2a938af4782c 100644 --- a/core/modules/node/src/Plugin/migrate/source/d6/ViewMode.php +++ b/core/modules/node/src/Plugin/migrate/source/d6/ViewMode.php @@ -71,7 +71,7 @@ public function getIds() { public function calculateDependencies() { $this->dependencies = parent::calculateDependencies(); if (isset($this->configuration['constants']['targetEntityType'])) { - $this->addDependency('module', $this->entityManager->getDefinition($this->configuration['constants']['targetEntityType'])->getProvider()); + $this->addDependency('module', $this->entityTypeManager->getDefinition($this->configuration['constants']['targetEntityType'])->getProvider()); } return $this->dependencies; } diff --git a/core/modules/node/src/Plugin/migrate/source/d7/Node.php b/core/modules/node/src/Plugin/migrate/source/d7/Node.php index 8018d4d01b46..4a8cce4408ed 100644 --- a/core/modules/node/src/Plugin/migrate/source/d7/Node.php +++ b/core/modules/node/src/Plugin/migrate/source/d7/Node.php @@ -45,7 +45,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_definition, $migration, $container->get('state'), - $container->get('entity.manager'), + $container->get('entity_type.manager'), $container->get('module_handler') ); } diff --git a/core/modules/node/src/Plugin/views/argument/Nid.php b/core/modules/node/src/Plugin/views/argument/Nid.php index 3680ee738bb5..382b66643ed9 100644 --- a/core/modules/node/src/Plugin/views/argument/Nid.php +++ b/core/modules/node/src/Plugin/views/argument/Nid.php @@ -44,7 +44,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager')->getStorage('node') + $container->get('entity_type.manager')->getStorage('node') ); } diff --git a/core/modules/node/src/Plugin/views/argument/Type.php b/core/modules/node/src/Plugin/views/argument/Type.php index 1a78c2faf06a..135e3952cb3c 100644 --- a/core/modules/node/src/Plugin/views/argument/Type.php +++ b/core/modules/node/src/Plugin/views/argument/Type.php @@ -42,12 +42,12 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - $entity_manager = $container->get('entity.manager'); + $entity_type_manager = $container->get('entity_type.manager'); return new static( $configuration, $plugin_id, $plugin_definition, - $entity_manager->getStorage('node_type') + $entity_type_manager->getStorage('node_type') ); } diff --git a/core/modules/node/src/Plugin/views/argument/Vid.php b/core/modules/node/src/Plugin/views/argument/Vid.php index 32de757c60a6..ff1c0aca670f 100644 --- a/core/modules/node/src/Plugin/views/argument/Vid.php +++ b/core/modules/node/src/Plugin/views/argument/Vid.php @@ -58,7 +58,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_id, $plugin_definition, $container->get('database'), - $container->get('entity.manager')->getStorage('node') + $container->get('entity_type.manager')->getStorage('node') ); } diff --git a/core/modules/node/tests/src/Functional/NodeEditFormTest.php b/core/modules/node/tests/src/Functional/NodeEditFormTest.php index 642fba31b828..014f98136361 100644 --- a/core/modules/node/tests/src/Functional/NodeEditFormTest.php +++ b/core/modules/node/tests/src/Functional/NodeEditFormTest.php @@ -47,7 +47,7 @@ protected function setUp() { $this->adminUser = $this->drupalCreateUser(['bypass node access', 'administer nodes']); $this->drupalPlaceBlock('local_tasks_block'); - $this->nodeStorage = $this->container->get('entity.manager')->getStorage('node'); + $this->nodeStorage = $this->container->get('entity_type.manager')->getStorage('node'); } /** diff --git a/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php b/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php index df4ea12ab4f3..ba95a5eb3a21 100644 --- a/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php +++ b/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php @@ -109,7 +109,7 @@ protected function createNodeRevision(NodeInterface $node) { * Checks node revision operations. */ public function testRevisions() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $nodes = $this->nodes; $logs = $this->revisionLogs; diff --git a/core/modules/node/tests/src/Functional/NodeRevisionsTest.php b/core/modules/node/tests/src/Functional/NodeRevisionsTest.php index 78afe4a271f6..9571f79fa64c 100644 --- a/core/modules/node/tests/src/Functional/NodeRevisionsTest.php +++ b/core/modules/node/tests/src/Functional/NodeRevisionsTest.php @@ -134,7 +134,7 @@ protected function setUp() { * Checks node revision related operations. */ public function testRevisions() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $nodes = $this->nodes; $logs = $this->revisionLogs; @@ -305,7 +305,7 @@ public function testRevisions() { * Checks that revisions are correctly saved without log messages. */ public function testNodeRevisionWithoutLogMessage() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); // Create a node with an initial log message. $revision_log = $this->randomMachineName(10); $node = $this->drupalCreateNode(['revision_log' => $revision_log]); @@ -406,7 +406,7 @@ public function testRevisionTranslationRevert() { ]); $this->drupalPostForm($revert_translation_url, [], t('Revert')); /** @var \Drupal\node\NodeStorage $node_storage */ - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $node_storage->resetCache(); /** @var \Drupal\node\NodeInterface $node */ $node = $node_storage->load($node->id()); diff --git a/core/modules/node/tests/src/Functional/NodeRevisionsUiBypassAccessTest.php b/core/modules/node/tests/src/Functional/NodeRevisionsUiBypassAccessTest.php index c7a84f86d9ce..7d58b339277d 100644 --- a/core/modules/node/tests/src/Functional/NodeRevisionsUiBypassAccessTest.php +++ b/core/modules/node/tests/src/Functional/NodeRevisionsUiBypassAccessTest.php @@ -50,7 +50,7 @@ public function testDisplayRevisionTab() { $this->drupalPlaceBlock('local_tasks_block'); $this->drupalLogin($this->editor); - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); // Set page revision setting 'create new revision'. This will mean new // revisions are created by default when the node is edited. diff --git a/core/modules/node/tests/src/Functional/NodeRevisionsUiTest.php b/core/modules/node/tests/src/Functional/NodeRevisionsUiTest.php index 4b04a77b120d..625a84cbd22e 100644 --- a/core/modules/node/tests/src/Functional/NodeRevisionsUiTest.php +++ b/core/modules/node/tests/src/Functional/NodeRevisionsUiTest.php @@ -38,7 +38,7 @@ protected function setUp() { */ public function testNodeFormSaveWithoutRevision() { $this->drupalLogin($this->editor); - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); // Set page revision setting 'create new revision'. This will mean new // revisions are created by default when the node is edited. diff --git a/core/modules/node/tests/src/Functional/Views/BulkFormTest.php b/core/modules/node/tests/src/Functional/Views/BulkFormTest.php index eded04530d0a..823093b90649 100644 --- a/core/modules/node/tests/src/Functional/Views/BulkFormTest.php +++ b/core/modules/node/tests/src/Functional/Views/BulkFormTest.php @@ -287,7 +287,7 @@ public function testBulkDeletion() { */ protected function loadNode($id) { /** @var \Drupal\node\NodeStorage $storage */ - $storage = $this->container->get('entity.manager')->getStorage('node'); + $storage = $this->container->get('entity_type.manager')->getStorage('node'); $storage->resetCache([$id]); return $storage->load($id); } diff --git a/core/modules/node/tests/src/Functional/Views/FrontPageTest.php b/core/modules/node/tests/src/Functional/Views/FrontPageTest.php index 618119c06162..29fd702d9631 100644 --- a/core/modules/node/tests/src/Functional/Views/FrontPageTest.php +++ b/core/modules/node/tests/src/Functional/Views/FrontPageTest.php @@ -45,7 +45,7 @@ class FrontPageTest extends ViewTestBase { protected function setUp($import_test_views = TRUE) { parent::setUp($import_test_views); - $this->nodeStorage = $this->container->get('entity.manager') + $this->nodeStorage = $this->container->get('entity_type.manager') ->getStorage('node'); } diff --git a/core/modules/node/tests/src/Kernel/NodeListBuilderTest.php b/core/modules/node/tests/src/Kernel/NodeListBuilderTest.php index 420b30661e5a..8949d0b4ce4b 100644 --- a/core/modules/node/tests/src/Kernel/NodeListBuilderTest.php +++ b/core/modules/node/tests/src/Kernel/NodeListBuilderTest.php @@ -28,7 +28,7 @@ protected function setUp() { */ public function testCacheContexts() { /** @var \Drupal\Core\Entity\EntityListBuilderInterface $list_builder */ - $list_builder = $this->container->get('entity.manager')->getListBuilder('node'); + $list_builder = $this->container->get('entity_type.manager')->getListBuilder('node'); $build = $list_builder->render(); $this->container->get('renderer')->renderRoot($build); diff --git a/core/modules/path/tests/src/Functional/PathLanguageTest.php b/core/modules/path/tests/src/Functional/PathLanguageTest.php index e943c91e5783..3d7a2d6199e8 100644 --- a/core/modules/path/tests/src/Functional/PathLanguageTest.php +++ b/core/modules/path/tests/src/Functional/PathLanguageTest.php @@ -71,7 +71,7 @@ protected function setUp() { * Test alias functionality through the admin interfaces. */ public function testAliasTranslation() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $english_node = $this->drupalCreateNode(['type' => 'page', 'langcode' => 'en']); $english_alias = $this->randomMachineName(); diff --git a/core/modules/quickedit/src/Form/QuickEditFieldForm.php b/core/modules/quickedit/src/Form/QuickEditFieldForm.php index 0f5aa8c8f664..4f6bc3282862 100644 --- a/core/modules/quickedit/src/Form/QuickEditFieldForm.php +++ b/core/modules/quickedit/src/Form/QuickEditFieldForm.php @@ -64,7 +64,7 @@ public static function create(ContainerInterface $container) { return new static( $container->get('tempstore.private'), $container->get('module_handler'), - $container->get('entity.manager')->getStorage('node_type') + $container->get('entity_type.manager')->getStorage('node_type') ); } diff --git a/core/modules/rdf/tests/src/Functional/FileFieldAttributesTest.php b/core/modules/rdf/tests/src/Functional/FileFieldAttributesTest.php index 41b85880ab62..f756c9e28db0 100644 --- a/core/modules/rdf/tests/src/Functional/FileFieldAttributesTest.php +++ b/core/modules/rdf/tests/src/Functional/FileFieldAttributesTest.php @@ -43,7 +43,7 @@ class FileFieldAttributesTest extends FileFieldTestBase { protected function setUp() { parent::setUp(); - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $this->fieldName = strtolower($this->randomMachineName()); $type_name = 'article'; diff --git a/core/modules/rdf/tests/src/Unit/RdfMappingConfigEntityUnitTest.php b/core/modules/rdf/tests/src/Unit/RdfMappingConfigEntityUnitTest.php index 620dbcbb60d6..62160d8795bd 100644 --- a/core/modules/rdf/tests/src/Unit/RdfMappingConfigEntityUnitTest.php +++ b/core/modules/rdf/tests/src/Unit/RdfMappingConfigEntityUnitTest.php @@ -3,7 +3,6 @@ namespace Drupal\Tests\rdf\Unit; use Drupal\Core\DependencyInjection\ContainerBuilder; -use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Tests\UnitTestCase; use Drupal\rdf\Entity\RdfMapping; @@ -21,13 +20,6 @@ class RdfMappingConfigEntityUnitTest extends UnitTestCase { */ protected $entityType; - /** - * The entity manager used for testing. - * - * @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $entityManager; - /** * The entity type manager used for testing. * @@ -60,16 +52,13 @@ protected function setUp() { ->method('getProvider') ->will($this->returnValue('entity')); - $this->entityManager = new EntityManager(); $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class); $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface'); $container = new ContainerBuilder(); - $container->set('entity.manager', $this->entityManager); $container->set('entity_type.manager', $this->entityTypeManager); $container->set('uuid', $this->uuid); - $this->entityManager->setContainer($container); \Drupal::setContainer($container); } diff --git a/core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php b/core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php index 362d7623ddc4..dcd059cf7779 100644 --- a/core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php +++ b/core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php @@ -105,8 +105,8 @@ public static function create(ContainerInterface $container, array $configuratio $configuration['label'], $configuration['view_mode'], $configuration['third_party_settings'], - $container->get('entity.manager')->getStorage('responsive_image_style'), - $container->get('entity.manager')->getStorage('image_style'), + $container->get('entity_type.manager')->getStorage('responsive_image_style'), + $container->get('entity_type.manager')->getStorage('image_style'), $container->get('link_generator'), $container->get('current_user') ); diff --git a/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php b/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php index c01bd85c5f11..ae9f7be86dd8 100644 --- a/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php +++ b/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php @@ -171,7 +171,7 @@ protected function addTestImageStyleMappings($empty_styles = FALSE) { protected function doTestResponsiveImageFieldFormatters($scheme, $empty_styles = FALSE) { /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = $this->container->get('renderer'); - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $field_name = mb_strtolower($this->randomMachineName()); $this->createImageField($field_name, 'article', ['uri_scheme' => $scheme]); // Create a new node with an image attached. Make sure we use a large image @@ -202,7 +202,7 @@ protected function doTestResponsiveImageFieldFormatters($scheme, $empty_styles = 'type' => 'responsive_image_test', 'settings' => ResponsiveImageFormatter::defaultSettings(), ]; - $display = $this->container->get('entity.manager') + $display = $this->container->get('entity_type.manager') ->getStorage('entity_view_display') ->load('node.article.default'); if (!$display) { @@ -212,7 +212,7 @@ protected function doTestResponsiveImageFieldFormatters($scheme, $empty_styles = 'mode' => 'default', 'status' => TRUE, ]; - $display = $this->container->get('entity.manager')->getStorage('entity_view_display')->create($values); + $display = $this->container->get('entity_type.manager')->getStorage('entity_view_display')->create($values); } $display->setComponent($field_name, $display_options)->save(); @@ -369,7 +369,7 @@ public function testResponsiveImageFieldFormattersEmptyMediaQuery() { 'image_mapping' => 'thumbnail', ]) ->save(); - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $field_name = mb_strtolower($this->randomMachineName()); $this->createImageField($field_name, 'article', ['uri_scheme' => 'public']); // Create a new node with an image attached. @@ -418,7 +418,7 @@ public function testResponsiveImageFieldFormattersOneSource() { 'image_mapping' => 'large', ]) ->save(); - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $field_name = mb_strtolower($this->randomMachineName()); $this->createImageField($field_name, 'article', ['uri_scheme' => 'public']); // Create a new node with an image attached. @@ -484,7 +484,7 @@ private function assertResponsiveImageFieldFormattersLink($link_type) { $this->assertPattern('/picture/'); $nid = $this->uploadNodeImage($test_image, $field_name, 'article'); - $this->container->get('entity.manager')->getStorage('node')->resetCache([$nid]); + $this->container->get('entity_type.manager')->getStorage('node')->resetCache([$nid]); $node = Node::load($nid); // Use the responsive image formatter linked to file formatter. diff --git a/core/modules/rest/src/EventSubscriber/EntityResourcePostRouteSubscriber.php b/core/modules/rest/src/EventSubscriber/EntityResourcePostRouteSubscriber.php index 36a3f7311709..80d29dc3f413 100644 --- a/core/modules/rest/src/EventSubscriber/EntityResourcePostRouteSubscriber.php +++ b/core/modules/rest/src/EventSubscriber/EntityResourcePostRouteSubscriber.php @@ -15,7 +15,7 @@ class EntityResourcePostRouteSubscriber implements EventSubscriberInterface { /** * The REST resource config storage. * - * @var \Drupal\Core\Entity\EntityManagerInterface + * @var \Drupal\Core\Entity\EntityStorageInterface */ protected $resourceConfigStorage; diff --git a/core/modules/rest/src/Plugin/Deriver/EntityDeriver.php b/core/modules/rest/src/Plugin/Deriver/EntityDeriver.php index 6d79589d14d3..919e1220dd41 100644 --- a/core/modules/rest/src/Plugin/Deriver/EntityDeriver.php +++ b/core/modules/rest/src/Plugin/Deriver/EntityDeriver.php @@ -49,7 +49,7 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager) { */ public static function create(ContainerInterface $container, $base_plugin_id) { return new static( - $container->get('entity.manager') + $container->get('entity_type.manager') ); } diff --git a/core/modules/rest/src/RestPermissions.php b/core/modules/rest/src/RestPermissions.php index 473c1924ee1d..7255d3f48141 100644 --- a/core/modules/rest/src/RestPermissions.php +++ b/core/modules/rest/src/RestPermissions.php @@ -22,7 +22,7 @@ class RestPermissions implements ContainerInjectionInterface { /** * The REST resource config storage. * - * @var \Drupal\Core\Entity\EntityManagerInterface + * @var \Drupal\Core\Entity\EntityStorageInterface */ protected $resourceConfigStorage; diff --git a/core/modules/search/src/Plugin/migrate/destination/EntitySearchPage.php b/core/modules/search/src/Plugin/migrate/destination/EntitySearchPage.php index cc95ae0699f6..75d74ac3173c 100644 --- a/core/modules/search/src/Plugin/migrate/destination/EntitySearchPage.php +++ b/core/modules/search/src/Plugin/migrate/destination/EntitySearchPage.php @@ -68,7 +68,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_id, $plugin_definition, $migration, - $container->get('entity.manager')->getStorage($entity_type_id), + $container->get('entity_type.manager')->getStorage($entity_type_id), array_keys($container->get('entity_type.bundle.info')->getBundleInfo($entity_type_id)), $container->get('language_manager'), $container->get('config.factory'), diff --git a/core/modules/search/tests/src/Functional/SearchCommentTest.php b/core/modules/search/tests/src/Functional/SearchCommentTest.php index a77d7357426f..8be5cd8e4a47 100644 --- a/core/modules/search/tests/src/Functional/SearchCommentTest.php +++ b/core/modules/search/tests/src/Functional/SearchCommentTest.php @@ -89,7 +89,7 @@ protected function setUp() { * Verify that comments are rendered using proper format in search results. */ public function testSearchResultsComment() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); // Create basic_html format that escapes all HTML. $basic_html_format = FilterFormat::create([ 'format' => 'basic_html', diff --git a/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php b/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php index b14e4e386eb5..05e6684f2542 100644 --- a/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php +++ b/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php @@ -43,7 +43,7 @@ public function __construct(Connection $database, ShortcutSetStorageInterface $s public static function create(ContainerInterface $container) { return new static( $container->get('database'), - $container->get('entity.manager')->getStorage('shortcut_set') + $container->get('entity_type.manager')->getStorage('shortcut_set') ); } diff --git a/core/modules/shortcut/src/Form/SwitchShortcutSet.php b/core/modules/shortcut/src/Form/SwitchShortcutSet.php index a71aba28e084..bcf9993cd022 100644 --- a/core/modules/shortcut/src/Form/SwitchShortcutSet.php +++ b/core/modules/shortcut/src/Form/SwitchShortcutSet.php @@ -45,7 +45,7 @@ public function __construct(ShortcutSetStorageInterface $shortcut_set_storage) { */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager')->getStorage('shortcut_set') + $container->get('entity_type.manager')->getStorage('shortcut_set') ); } diff --git a/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php b/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php index 0cb843be76ca..a2c956cae489 100644 --- a/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php +++ b/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php @@ -52,7 +52,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_id, $plugin_definition, $migration, - $container->get('entity.manager')->getStorage('shortcut_set') + $container->get('entity_type.manager')->getStorage('shortcut_set') ); } diff --git a/core/modules/shortcut/src/ShortcutAccessControlHandler.php b/core/modules/shortcut/src/ShortcutAccessControlHandler.php index 3fe2734fb89b..dbfd3a688005 100644 --- a/core/modules/shortcut/src/ShortcutAccessControlHandler.php +++ b/core/modules/shortcut/src/ShortcutAccessControlHandler.php @@ -43,7 +43,7 @@ public function __construct(EntityTypeInterface $entity_type, ShortcutSetStorage public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( $entity_type, - $container->get('entity.manager')->getStorage('shortcut_set') + $container->get('entity_type.manager')->getStorage('shortcut_set') ); } diff --git a/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php b/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php index 636813cc8f57..5db2f939891e 100644 --- a/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php +++ b/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php @@ -38,7 +38,7 @@ public function testShortcutSetAdd() { 'id' => strtolower($this->randomMachineName()), ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $new_set = $this->container->get('entity.manager')->getStorage('shortcut_set')->load($edit['id']); + $new_set = $this->container->get('entity_type.manager')->getStorage('shortcut_set')->load($edit['id']); $this->assertIdentical($new_set->id(), $edit['id'], 'Successfully created a shortcut set.'); $this->drupalGet('user/' . $this->adminUser->id() . '/shortcuts'); $this->assertText($new_set->label(), 'Generated shortcut set was listed as a choice on the user account page.'); diff --git a/core/modules/system/src/Form/DateFormatFormBase.php b/core/modules/system/src/Form/DateFormatFormBase.php index 547b27d363b3..8e6cd82c9442 100644 --- a/core/modules/system/src/Form/DateFormatFormBase.php +++ b/core/modules/system/src/Form/DateFormatFormBase.php @@ -50,7 +50,7 @@ public function __construct(DateFormatterInterface $date_formatter, ConfigEntity public static function create(ContainerInterface $container) { return new static( $container->get('date.formatter'), - $container->get('entity.manager')->getStorage('date_format') + $container->get('entity_type.manager')->getStorage('date_format') ); } diff --git a/core/modules/system/src/Plugin/Derivative/SystemMenuBlock.php b/core/modules/system/src/Plugin/Derivative/SystemMenuBlock.php index 5da50271720f..d99c1454bef1 100644 --- a/core/modules/system/src/Plugin/Derivative/SystemMenuBlock.php +++ b/core/modules/system/src/Plugin/Derivative/SystemMenuBlock.php @@ -36,7 +36,7 @@ public function __construct(EntityStorageInterface $menu_storage) { */ public static function create(ContainerInterface $container, $base_plugin_id) { return new static( - $container->get('entity.manager')->getStorage('menu') + $container->get('entity_type.manager')->getStorage('menu') ); } diff --git a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php index 2aa64e86940b..3e4257938ce6 100644 --- a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php +++ b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php @@ -91,7 +91,7 @@ protected function setUp() { // Reload the entity now that a new field has been added to it. $storage = $this->container - ->get('entity.manager') + ->get('entity_type.manager') ->getStorage($this->entity->getEntityTypeId()); $storage->resetCache(); $this->entity = $storage->load($this->entity->id()); diff --git a/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php b/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php index e92b64700167..2d9c5f29ec7f 100644 --- a/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php +++ b/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php @@ -84,7 +84,7 @@ protected function setUp() { // Reload the entity now that a new field has been added to it. $storage = $this->container - ->get('entity.manager') + ->get('entity_type.manager') ->getStorage($this->entity->getEntityTypeId()); $storage->resetCache(); $this->entity = $storage->load($this->entity->id()); diff --git a/core/modules/system/tests/src/Functional/Entity/EntityFormTest.php b/core/modules/system/tests/src/Functional/Entity/EntityFormTest.php index 4f0b7f0f71fc..a82bb3e8593a 100644 --- a/core/modules/system/tests/src/Functional/Entity/EntityFormTest.php +++ b/core/modules/system/tests/src/Functional/Entity/EntityFormTest.php @@ -139,7 +139,7 @@ protected function doTestMultilingualFormCRUD($entity_type_id) { protected function loadEntityByName($entity_type, $name) { // Always load the entity from the database to ensure that changes are // correctly picked up. - $entity_storage = $this->container->get('entity.manager')->getStorage($entity_type); + $entity_storage = $this->container->get('entity_type.manager')->getStorage($entity_type); $entity_storage->resetCache(); $entities = $entity_storage->loadByProperties(['name' => $name]); return $entities ? current($entities) : NULL; diff --git a/core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php b/core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php index 94225f4e97dd..dec8dd8c7133 100644 --- a/core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php +++ b/core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php @@ -58,7 +58,7 @@ public function testPager() { */ public function testCacheContexts() { /** @var \Drupal\Core\Entity\EntityListBuilderInterface $list_builder */ - $list_builder = $this->container->get('entity.manager')->getListBuilder('entity_test'); + $list_builder = $this->container->get('entity_type.manager')->getListBuilder('entity_test'); $build = $list_builder->render(); $this->container->get('renderer')->renderRoot($build); diff --git a/core/modules/system/tests/src/Functional/Entity/EntityViewControllerTest.php b/core/modules/system/tests/src/Functional/Entity/EntityViewControllerTest.php index 3bbf9f98a0d3..3bd84036864a 100644 --- a/core/modules/system/tests/src/Functional/Entity/EntityViewControllerTest.php +++ b/core/modules/system/tests/src/Functional/Entity/EntityViewControllerTest.php @@ -144,7 +144,7 @@ protected function createTestEntity($entity_type) { 'bundle' => $entity_type, 'name' => $this->randomMachineName(), ]; - return $this->container->get('entity.manager')->getStorage($entity_type)->create($data); + return $this->container->get('entity_type.manager')->getStorage($entity_type)->create($data); } } diff --git a/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php b/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php index 3877b49ef9e2..56e888d5c5f4 100644 --- a/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php +++ b/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php @@ -158,7 +158,7 @@ public function testUninstall() { // Test an entity type without a label. /** @var \Drupal\Core\Entity\EntityStorageInterface $storage */ - $storage = $this->container->get('entity.manager') + $storage = $this->container->get('entity_type.manager') ->getStorage('entity_test_no_label'); $storage->create([ 'id' => mb_strtolower($this->randomMachineName()), diff --git a/core/modules/system/tests/src/Functional/System/TrustedHostsTest.php b/core/modules/system/tests/src/Functional/System/TrustedHostsTest.php index 7a65474c7f5c..8114ff4d4a31 100644 --- a/core/modules/system/tests/src/Functional/System/TrustedHostsTest.php +++ b/core/modules/system/tests/src/Functional/System/TrustedHostsTest.php @@ -82,9 +82,9 @@ public function testShortcut() { $this->rebuildContainer(); $this->container->get('router.builder')->rebuild(); - /** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */ - $entity_manager = $this->container->get('entity.manager'); - $shortcut_storage = $entity_manager->getStorage('shortcut'); + /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */ + $entity_type_manager = $this->container->get('entity_type.manager'); + $shortcut_storage = $entity_type_manager->getStorage('shortcut'); $shortcut = $shortcut_storage->create([ 'title' => $this->randomString(), @@ -94,7 +94,7 @@ public function testShortcut() { $shortcut_storage->save($shortcut); // Grant the current user access to see the shortcuts. - $role_storage = $entity_manager->getStorage('user_role'); + $role_storage = $entity_type_manager->getStorage('user_role'); $roles = $this->loggedInUser->getRoles(TRUE); /** @var \Drupal\user\RoleInterface $role */ $role = $role_storage->load(reset($roles)); diff --git a/core/modules/system/tests/src/Functional/Update/EntityUpdateAddRevisionDefaultTest.php b/core/modules/system/tests/src/Functional/Update/EntityUpdateAddRevisionDefaultTest.php index 26f5c2c9bf5d..fd8f6cf19245 100644 --- a/core/modules/system/tests/src/Functional/Update/EntityUpdateAddRevisionDefaultTest.php +++ b/core/modules/system/tests/src/Functional/Update/EntityUpdateAddRevisionDefaultTest.php @@ -18,13 +18,6 @@ class EntityUpdateAddRevisionDefaultTest extends UpdatePathTestBase { use EntityDefinitionTestTrait; use DbUpdatesTrait; - /** - * The entity manager service. - * - * @var \Drupal\Core\Entity\EntityManagerInterface - */ - protected $entityManager; - /** * The state service. * @@ -39,7 +32,6 @@ protected function setUp() { parent::setUp(); // Do not use this property after calling ::runUpdates(). - $this->entityManager = \Drupal::entityManager(); $this->state = \Drupal::state(); } diff --git a/core/modules/system/tests/src/Functional/Update/EntityUpdateAddRevisionTranslationAffectedTest.php b/core/modules/system/tests/src/Functional/Update/EntityUpdateAddRevisionTranslationAffectedTest.php index e14820b9bd01..0a3ebbe992ac 100644 --- a/core/modules/system/tests/src/Functional/Update/EntityUpdateAddRevisionTranslationAffectedTest.php +++ b/core/modules/system/tests/src/Functional/Update/EntityUpdateAddRevisionTranslationAffectedTest.php @@ -18,13 +18,6 @@ class EntityUpdateAddRevisionTranslationAffectedTest extends UpdatePathTestBase use EntityDefinitionTestTrait; use DbUpdatesTrait; - /** - * The entity manager service. - * - * @var \Drupal\Core\Entity\EntityManagerInterface - */ - protected $entityManager; - /** * The state service. * @@ -44,7 +37,6 @@ protected function setUp() { parent::setUp(); // Do not use this property after calling ::runUpdates(). - $this->entityManager = \Drupal::entityManager(); $this->state = \Drupal::state(); } diff --git a/core/modules/system/tests/src/Kernel/Action/ActionTest.php b/core/modules/system/tests/src/Kernel/Action/ActionTest.php index 6c381d7c80f7..dad380079f23 100644 --- a/core/modules/system/tests/src/Kernel/Action/ActionTest.php +++ b/core/modules/system/tests/src/Kernel/Action/ActionTest.php @@ -58,7 +58,7 @@ public function testOperations() { // Create a new unsaved user. $name = $this->randomMachineName(); - $user_storage = $this->container->get('entity.manager')->getStorage('user'); + $user_storage = $this->container->get('entity_type.manager')->getStorage('user'); $account = $user_storage->create(['name' => $name, 'bundle' => 'user']); $loaded_accounts = $user_storage->loadMultiple(); $this->assertEqual(count($loaded_accounts), 0); diff --git a/core/modules/system/tests/src/Kernel/Entity/EntityReferenceSelectionReferenceableTest.php b/core/modules/system/tests/src/Kernel/Entity/EntityReferenceSelectionReferenceableTest.php index 0a33a88c6459..54de7bf0b260 100644 --- a/core/modules/system/tests/src/Kernel/Entity/EntityReferenceSelectionReferenceableTest.php +++ b/core/modules/system/tests/src/Kernel/Entity/EntityReferenceSelectionReferenceableTest.php @@ -53,7 +53,7 @@ protected function setUp() { $this->installEntitySchema('node'); /** @var \Drupal\Core\Entity\EntityStorageInterface $storage */ - $storage = $this->container->get('entity.manager') + $storage = $this->container->get('entity_type.manager') ->getStorage('entity_test_no_label'); // Create a new node-type. diff --git a/core/modules/taxonomy/src/Form/OverviewTerms.php b/core/modules/taxonomy/src/Form/OverviewTerms.php index 3656a751ae33..75fe42cd7677 100644 --- a/core/modules/taxonomy/src/Form/OverviewTerms.php +++ b/core/modules/taxonomy/src/Form/OverviewTerms.php @@ -36,9 +36,9 @@ class OverviewTerms extends FormBase { protected $moduleHandler; /** - * The entity manager. + * The entity type manager. * - * @var \Drupal\Core\Entity\EntityManagerInterface + * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; diff --git a/core/modules/taxonomy/src/Form/VocabularyResetForm.php b/core/modules/taxonomy/src/Form/VocabularyResetForm.php index 763e14b131b6..c806c33abdc0 100644 --- a/core/modules/taxonomy/src/Form/VocabularyResetForm.php +++ b/core/modules/taxonomy/src/Form/VocabularyResetForm.php @@ -36,7 +36,7 @@ public function __construct(TermStorageInterface $term_storage) { */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager')->getStorage('taxonomy_term') + $container->get('entity_type.manager')->getStorage('taxonomy_term') ); } diff --git a/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php index 57a2efabb161..120fa9c83c34 100644 --- a/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php +++ b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php @@ -40,7 +40,12 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static($configuration, $plugin_id, $plugin_definition, $container->get('entity.manager')->getStorage('taxonomy_term')); + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('entity_type.manager')->getStorage('taxonomy_term') + ); } protected function defineOptions() { diff --git a/core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php b/core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php index b02b84fbab2b..ee2a2ab34f58 100644 --- a/core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php +++ b/core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php @@ -38,7 +38,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager')->getStorage('taxonomy_term') + $container->get('entity_type.manager')->getStorage('taxonomy_term') ); } diff --git a/core/modules/taxonomy/src/Plugin/views/argument/VocabularyVid.php b/core/modules/taxonomy/src/Plugin/views/argument/VocabularyVid.php index 3527ee584f77..c0e3e4e1e97a 100644 --- a/core/modules/taxonomy/src/Plugin/views/argument/VocabularyVid.php +++ b/core/modules/taxonomy/src/Plugin/views/argument/VocabularyVid.php @@ -47,7 +47,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager')->getStorage('taxonomy_vocabulary') + $container->get('entity_type.manager')->getStorage('taxonomy_vocabulary') ); } diff --git a/core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php b/core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php index 6d8545b0ee55..eb1bc5a47b84 100644 --- a/core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php +++ b/core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php @@ -68,7 +68,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_id, $plugin_definition, $container->get('current_route_match'), - $container->get('entity.manager')->getStorage('taxonomy_vocabulary') + $container->get('entity_type.manager')->getStorage('taxonomy_vocabulary') ); } diff --git a/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php b/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php index 7dda500d7c9c..70ca470d9bfd 100644 --- a/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php +++ b/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php @@ -50,7 +50,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager')->getStorage('taxonomy_vocabulary') + $container->get('entity_type.manager')->getStorage('taxonomy_vocabulary') ); } diff --git a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php index 920bc0e33bc6..5829681767c7 100644 --- a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php +++ b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php @@ -66,8 +66,8 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager')->getStorage('taxonomy_vocabulary'), - $container->get('entity.manager')->getStorage('taxonomy_term') + $container->get('entity_type.manager')->getStorage('taxonomy_vocabulary'), + $container->get('entity_type.manager')->getStorage('taxonomy_term') ); } diff --git a/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php b/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php index b757c23f4255..5a88acea4d8b 100644 --- a/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php +++ b/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php @@ -51,7 +51,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager')->getStorage('taxonomy_vocabulary') + $container->get('entity_type.manager')->getStorage('taxonomy_vocabulary') ); } diff --git a/core/modules/taxonomy/src/TaxonomyPermissions.php b/core/modules/taxonomy/src/TaxonomyPermissions.php index 6a0b0d69a263..73df3c869031 100644 --- a/core/modules/taxonomy/src/TaxonomyPermissions.php +++ b/core/modules/taxonomy/src/TaxonomyPermissions.php @@ -45,7 +45,7 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager) { * {@inheritdoc} */ public static function create(ContainerInterface $container) { - return new static($container->get('entity.manager')); + return new static($container->get('entity_type.manager')); } /** diff --git a/core/modules/taxonomy/src/VocabularyForm.php b/core/modules/taxonomy/src/VocabularyForm.php index d80b72b4debf..a9e13b8b93ee 100644 --- a/core/modules/taxonomy/src/VocabularyForm.php +++ b/core/modules/taxonomy/src/VocabularyForm.php @@ -38,7 +38,7 @@ public function __construct(VocabularyStorageInterface $vocabulary_storage) { */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager')->getStorage('taxonomy_vocabulary') + $container->get('entity_type.manager')->getStorage('taxonomy_vocabulary') ); } diff --git a/core/modules/taxonomy/tests/src/Functional/TaxonomyTermIndentationTest.php b/core/modules/taxonomy/tests/src/Functional/TaxonomyTermIndentationTest.php index eb57142c87e2..89de4c54989f 100644 --- a/core/modules/taxonomy/tests/src/Functional/TaxonomyTermIndentationTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TaxonomyTermIndentationTest.php @@ -40,7 +40,7 @@ public function testTermIndentation() { $term3 = $this->createTerm($this->vocabulary); // Get the taxonomy storage. - $taxonomy_storage = $this->container->get('entity.manager')->getStorage('taxonomy_term'); + $taxonomy_storage = $this->container->get('entity_type.manager')->getStorage('taxonomy_term'); // Indent the second term under the first one. $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->get('vid') . '/overview'); diff --git a/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php b/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php index 87c2f5fbc1da..130569dbce0e 100644 --- a/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php @@ -92,7 +92,7 @@ protected function setUp() { * Tests that the taxonomy index is maintained properly. */ public function testTaxonomyIndex() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); // Create terms in the vocabulary. $term_1 = $this->createTerm($this->vocabulary); $term_2 = $this->createTerm($this->vocabulary); diff --git a/core/modules/taxonomy/tests/src/Functional/TermTest.php b/core/modules/taxonomy/tests/src/Functional/TermTest.php index 0700023445d0..ca283b33f635 100644 --- a/core/modules/taxonomy/tests/src/Functional/TermTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TermTest.php @@ -131,7 +131,7 @@ public function testTaxonomyTermChildTerms() { $term1 = $this->createTerm($this->vocabulary); $terms_array = []; - $taxonomy_storage = $this->container->get('entity.manager')->getStorage('taxonomy_term'); + $taxonomy_storage = $this->container->get('entity_type.manager')->getStorage('taxonomy_term'); // Create 40 terms. Terms 1-12 get parent of $term1. All others are // individual terms. @@ -257,7 +257,7 @@ public function testNodeTermCreationAndDeletion() { foreach ($terms as $term) { $this->assertText($term, 'The term appears on the node preview.'); } - $tree = $this->container->get('entity.manager')->getStorage('taxonomy_term')->loadTree($this->vocabulary->id()); + $tree = $this->container->get('entity_type.manager')->getStorage('taxonomy_term')->loadTree($this->vocabulary->id()); $this->assertTrue(empty($tree), 'The terms are not created on preview.'); // taxonomy.module does not maintain its static caches. @@ -396,7 +396,7 @@ public function testTermReorder() { $this->createTerm($this->vocabulary); $this->createTerm($this->vocabulary); - $taxonomy_storage = $this->container->get('entity.manager')->getStorage('taxonomy_term'); + $taxonomy_storage = $this->container->get('entity_type.manager')->getStorage('taxonomy_term'); // Fetch the created terms in the default alphabetical order, i.e. term1 // precedes term2 alphabetically, and term2 precedes term3. @@ -478,7 +478,7 @@ public function testTermMultipleParentsInterface() { $this->assertEqual($edit['description[0][value]'], $term->getDescription(), 'Term description was successfully saved.'); // Check that the parent tid is still there. The other parent (<root>) is // not added by \Drupal\taxonomy\TermStorageInterface::loadParents(). - $parents = $this->container->get('entity.manager')->getStorage('taxonomy_term')->loadParents($term->id()); + $parents = $this->container->get('entity_type.manager')->getStorage('taxonomy_term')->loadParents($term->id()); $parent = reset($parents); $this->assertEqual($edit['parent[]'][1], $parent->id(), 'Term parents were successfully saved.'); } diff --git a/core/modules/taxonomy/tests/src/Functional/VocabularyCrudTest.php b/core/modules/taxonomy/tests/src/Functional/VocabularyCrudTest.php index 1fb01630bf67..659a97551360 100644 --- a/core/modules/taxonomy/tests/src/Functional/VocabularyCrudTest.php +++ b/core/modules/taxonomy/tests/src/Functional/VocabularyCrudTest.php @@ -124,7 +124,7 @@ public function testTaxonomyVocabularyLoadMultiple() { $this->assertIdentical($loaded_order, $expected_order); // Test loading vocabularies by their properties. - $controller = $this->container->get('entity.manager')->getStorage('taxonomy_vocabulary'); + $controller = $this->container->get('entity_type.manager')->getStorage('taxonomy_vocabulary'); // Fetch vocabulary 1 by name. $vocabulary = current($controller->loadByProperties(['name' => $vocabulary1->label()])); $this->assertEqual($vocabulary->id(), $vocabulary1->id(), 'Vocabulary loaded successfully by name.'); diff --git a/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php b/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php index 2620cb8fc479..7cddcc58199a 100644 --- a/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php +++ b/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php @@ -99,7 +99,7 @@ public function testTaxonomyAdminChangingWeights() { $this->drupalPostForm('admin/structure/taxonomy', $edit, t('Save')); // Load the vocabularies from the database. - $this->container->get('entity.manager')->getStorage('taxonomy_vocabulary')->resetCache(); + $this->container->get('entity_type.manager')->getStorage('taxonomy_vocabulary')->resetCache(); $new_vocabularies = Vocabulary::loadMultiple(); // Check that the weights are saved in the database correctly. @@ -138,7 +138,7 @@ public function testTaxonomyAdminDeletingVocabulary() { $this->assertText(t('Created new vocabulary'), 'New vocabulary was created.'); // Check the created vocabulary. - $this->container->get('entity.manager')->getStorage('taxonomy_vocabulary')->resetCache(); + $this->container->get('entity_type.manager')->getStorage('taxonomy_vocabulary')->resetCache(); $vocabulary = Vocabulary::load($vid); $this->assertTrue($vocabulary, 'Vocabulary found.'); @@ -151,7 +151,7 @@ public function testTaxonomyAdminDeletingVocabulary() { // Confirm deletion. $this->drupalPostForm(NULL, NULL, t('Delete')); $this->assertRaw(t('Deleted vocabulary %name.', ['%name' => $vocabulary->label()]), 'Vocabulary deleted.'); - $this->container->get('entity.manager')->getStorage('taxonomy_vocabulary')->resetCache(); + $this->container->get('entity_type.manager')->getStorage('taxonomy_vocabulary')->resetCache(); $this->assertFalse(Vocabulary::load($vid), 'Vocabulary not found.'); } diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTest.php index 8e7d13de0e30..e16c70a30b85 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTest.php @@ -34,7 +34,7 @@ public function testTermNode() { // This is a base plugin id and we want to run all derivatives. $this->executeMigrations(['d6_term_node']); - $this->container->get('entity.manager') + $this->container->get('entity_type.manager') ->getStorage('node') ->resetCache([1, 2]); diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTranslationTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTranslationTest.php index 69d454c37955..51efcd35d717 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTranslationTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTranslationTest.php @@ -52,7 +52,7 @@ protected function setUp() { * Tests the Drupal 6 term-node association to Drupal 8 migration. */ public function testTermNode() { - $this->container->get('entity.manager') + $this->container->get('entity_type.manager') ->getStorage('node') ->resetCache([18, 21]); diff --git a/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php b/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php index c2d9d667c976..9709b65efc92 100644 --- a/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php @@ -54,7 +54,7 @@ public function testMultipleParentDelete() { $child_term_id = $child_term->id(); $parent_term1->delete(); - $term_storage = $this->container->get('entity.manager')->getStorage('taxonomy_term'); + $term_storage = $this->container->get('entity_type.manager')->getStorage('taxonomy_term'); $term_storage->resetCache([$child_term_id]); $child_term = Term::load($child_term_id); $this->assertTrue(!empty($child_term), 'Child term is not deleted if only one of its parents is removed.'); @@ -77,7 +77,7 @@ public function testTaxonomyVocabularyTree() { } // Get the taxonomy storage. - $taxonomy_storage = $this->container->get('entity.manager')->getStorage('taxonomy_term'); + $taxonomy_storage = $this->container->get('entity_type.manager')->getStorage('taxonomy_term'); // Set the weight on $term[1] so it appears before $term[5] when fetching // the parents for $term[2], in order to test for a regression on diff --git a/core/modules/text/tests/src/Functional/TextFieldTest.php b/core/modules/text/tests/src/Functional/TextFieldTest.php index 7e7ce2b5e2ea..489d70fc593b 100644 --- a/core/modules/text/tests/src/Functional/TextFieldTest.php +++ b/core/modules/text/tests/src/Functional/TextFieldTest.php @@ -243,7 +243,7 @@ public function _testTextfieldWidgetsFormatted($field_type, $widget_type) { $this->assertText(t('entity_test @id has been updated.', ['@id' => $id]), 'Entity was updated'); // Display the entity. - $this->container->get('entity.manager')->getStorage('entity_test')->resetCache([$id]); + $this->container->get('entity_type.manager')->getStorage('entity_test')->resetCache([$id]); $entity = EntityTest::load($id); $display = $display_repository->getViewDisplay($entity->getEntityTypeId(), $entity->bundle(), 'full'); $content = $display->build($entity); diff --git a/core/modules/user/src/AccountSettingsForm.php b/core/modules/user/src/AccountSettingsForm.php index f00d973f0f4b..3846d3b38a9c 100644 --- a/core/modules/user/src/AccountSettingsForm.php +++ b/core/modules/user/src/AccountSettingsForm.php @@ -53,7 +53,7 @@ public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), $container->get('module_handler'), - $container->get('entity.manager')->getStorage('user_role') + $container->get('entity_type.manager')->getStorage('user_role') ); } diff --git a/core/modules/user/src/Controller/UserController.php b/core/modules/user/src/Controller/UserController.php index 6fbc0cd2f9ef..b7cffa661925 100644 --- a/core/modules/user/src/Controller/UserController.php +++ b/core/modules/user/src/Controller/UserController.php @@ -73,7 +73,7 @@ public function __construct(DateFormatterInterface $date_formatter, UserStorageI public static function create(ContainerInterface $container) { return new static( $container->get('date.formatter'), - $container->get('entity.manager')->getStorage('user'), + $container->get('entity_type.manager')->getStorage('user'), $container->get('user.data'), $container->get('logger.factory')->get('user') ); diff --git a/core/modules/user/src/Form/UserLoginForm.php b/core/modules/user/src/Form/UserLoginForm.php index ac5324abe650..ebdf1252140e 100644 --- a/core/modules/user/src/Form/UserLoginForm.php +++ b/core/modules/user/src/Form/UserLoginForm.php @@ -71,7 +71,7 @@ public function __construct(FloodInterface $flood, UserStorageInterface $user_st public static function create(ContainerInterface $container) { return new static( $container->get('flood'), - $container->get('entity.manager')->getStorage('user'), + $container->get('entity_type.manager')->getStorage('user'), $container->get('user.auth'), $container->get('renderer') ); diff --git a/core/modules/user/src/Form/UserPasswordForm.php b/core/modules/user/src/Form/UserPasswordForm.php index 7bb2f830ae8c..8291ad5de4c2 100644 --- a/core/modules/user/src/Form/UserPasswordForm.php +++ b/core/modules/user/src/Form/UserPasswordForm.php @@ -51,7 +51,7 @@ public function __construct(UserStorageInterface $user_storage, LanguageManagerI */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager')->getStorage('user'), + $container->get('entity_type.manager')->getStorage('user'), $container->get('language_manager') ); } diff --git a/core/modules/user/src/Form/UserPermissionsForm.php b/core/modules/user/src/Form/UserPermissionsForm.php index 0f7f0378daa0..1ce0e117e0f9 100644 --- a/core/modules/user/src/Form/UserPermissionsForm.php +++ b/core/modules/user/src/Form/UserPermissionsForm.php @@ -59,7 +59,7 @@ public function __construct(PermissionHandlerInterface $permission_handler, Role public static function create(ContainerInterface $container) { return new static( $container->get('user.permissions'), - $container->get('entity.manager')->getStorage('user_role'), + $container->get('entity_type.manager')->getStorage('user_role'), $container->get('module_handler') ); } diff --git a/core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php b/core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php index de4c4040fecb..e496e1f9fa89 100644 --- a/core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php +++ b/core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php @@ -41,7 +41,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager')->getDefinition('user_role') + $container->get('entity_type.manager')->getDefinition('user_role') ); } diff --git a/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php b/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php index 5d462b661899..e606c5a8509d 100644 --- a/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php +++ b/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php @@ -74,7 +74,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager'), + $container->get('entity_type.manager'), $container->get('module_handler'), $container->get('current_user'), $container->get('database'), diff --git a/core/modules/user/src/Plugin/Validation/Constraint/ProtectedUserFieldConstraintValidator.php b/core/modules/user/src/Plugin/Validation/Constraint/ProtectedUserFieldConstraintValidator.php index a8b12af8f440..a35a0d9ad58c 100644 --- a/core/modules/user/src/Plugin/Validation/Constraint/ProtectedUserFieldConstraintValidator.php +++ b/core/modules/user/src/Plugin/Validation/Constraint/ProtectedUserFieldConstraintValidator.php @@ -46,7 +46,7 @@ public function __construct(UserStorageInterface $user_storage, AccountProxyInte */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager')->getStorage('user'), + $container->get('entity_type.manager')->getStorage('user'), $container->get('current_user') ); } diff --git a/core/modules/user/src/Plugin/views/access/Role.php b/core/modules/user/src/Plugin/views/access/Role.php index d1fe8abcc240..c75c186babe7 100644 --- a/core/modules/user/src/Plugin/views/access/Role.php +++ b/core/modules/user/src/Plugin/views/access/Role.php @@ -61,7 +61,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager')->getStorage('user_role') + $container->get('entity_type.manager')->getStorage('user_role') ); } diff --git a/core/modules/user/src/Plugin/views/argument/RolesRid.php b/core/modules/user/src/Plugin/views/argument/RolesRid.php index 4d909dcbd92f..e45008cbf6e6 100644 --- a/core/modules/user/src/Plugin/views/argument/RolesRid.php +++ b/core/modules/user/src/Plugin/views/argument/RolesRid.php @@ -44,7 +44,12 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static($configuration, $plugin_id, $plugin_definition, $container->get('entity.manager')); + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('entity_type.manager') + ); } /** diff --git a/core/modules/user/src/Plugin/views/argument/Uid.php b/core/modules/user/src/Plugin/views/argument/Uid.php index 31f6c33af84f..7a1e6c00204d 100644 --- a/core/modules/user/src/Plugin/views/argument/Uid.php +++ b/core/modules/user/src/Plugin/views/argument/Uid.php @@ -43,8 +43,12 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static($configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager')->getStorage('user')); + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('entity_type.manager')->getStorage('user') + ); } /** diff --git a/core/modules/user/src/Plugin/views/field/Permissions.php b/core/modules/user/src/Plugin/views/field/Permissions.php index ac8c3184c465..705ba7a58924 100644 --- a/core/modules/user/src/Plugin/views/field/Permissions.php +++ b/core/modules/user/src/Plugin/views/field/Permissions.php @@ -57,7 +57,13 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static($configuration, $plugin_id, $plugin_definition, $container->get('module_handler'), $container->get('entity.manager')); + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('module_handler'), + $container->get('entity_type.manager') + ); } /** diff --git a/core/modules/user/src/Plugin/views/filter/Roles.php b/core/modules/user/src/Plugin/views/filter/Roles.php index a6986f2257cf..83dfbb33704c 100644 --- a/core/modules/user/src/Plugin/views/filter/Roles.php +++ b/core/modules/user/src/Plugin/views/filter/Roles.php @@ -48,7 +48,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager')->getStorage('user_role') + $container->get('entity_type.manager')->getStorage('user_role') ); } diff --git a/core/modules/user/tests/src/Functional/AccessRoleUITest.php b/core/modules/user/tests/src/Functional/AccessRoleUITest.php index 6c1004c9d432..d5346b1237eb 100644 --- a/core/modules/user/tests/src/Functional/AccessRoleUITest.php +++ b/core/modules/user/tests/src/Functional/AccessRoleUITest.php @@ -40,14 +40,14 @@ protected function setUp($import_test_views = TRUE) { * Tests the role access plugin UI. */ public function testAccessRoleUI() { - $entity_manager = $this->container->get('entity.manager'); - $entity_manager->getStorage('user_role')->create(['id' => 'custom_role', 'label' => 'Custom role'])->save(); + $entity_type_manager = $this->container->get('entity_type.manager'); + $entity_type_manager->getStorage('user_role')->create(['id' => 'custom_role', 'label' => 'Custom role'])->save(); $access_url = "admin/structure/views/nojs/display/test_access_role/default/access_options"; $this->drupalPostForm($access_url, ['access_options[role][custom_role]' => 1], t('Apply')); $this->assertResponse(200); $this->drupalPostForm(NULL, [], t('Save')); - $view = $entity_manager->getStorage('view')->load('test_access_role'); + $view = $entity_type_manager->getStorage('view')->load('test_access_role'); $display = $view->getDisplay('default'); $this->assertEqual($display['display_options']['access']['options']['role'], ['custom_role' => 'custom_role']); @@ -56,7 +56,7 @@ public function testAccessRoleUI() { $this->drupalPostForm('admin/structure/views/nojs/display/test_access_role/default/access', ['access[type]' => 'none'], t('Apply')); $this->drupalPostForm(NULL, [], t('Save')); // Verify that role option is not set. - $view = $entity_manager->getStorage('view')->load('test_access_role'); + $view = $entity_type_manager->getStorage('view')->load('test_access_role'); $display = $view->getDisplay('default'); $this->assertFalse(isset($display['display_options']['access']['options']['role'])); } diff --git a/core/modules/user/tests/src/Functional/UserAdminTest.php b/core/modules/user/tests/src/Functional/UserAdminTest.php index d870ba56e28d..298d41493eaf 100644 --- a/core/modules/user/tests/src/Functional/UserAdminTest.php +++ b/core/modules/user/tests/src/Functional/UserAdminTest.php @@ -41,7 +41,7 @@ public function testUserAdmin() { $user_c->name = 'User C'; $user_c->save(); - $user_storage = $this->container->get('entity.manager')->getStorage('user'); + $user_storage = $this->container->get('entity_type.manager')->getStorage('user'); // Create admin user to delete registered user. $admin_user = $this->drupalCreateUser(['administer users']); diff --git a/core/modules/user/tests/src/Functional/UserCancelTest.php b/core/modules/user/tests/src/Functional/UserCancelTest.php index 631b35183a7b..365be54f48c9 100644 --- a/core/modules/user/tests/src/Functional/UserCancelTest.php +++ b/core/modules/user/tests/src/Functional/UserCancelTest.php @@ -34,9 +34,9 @@ protected function setUp() { * Attempt to cancel account without permission. */ public function testUserCancelWithoutPermission() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $this->config('user.settings')->set('cancel_method', 'user_cancel_reassign')->save(); - $user_storage = $this->container->get('entity.manager')->getStorage('user'); + $user_storage = $this->container->get('entity_type.manager')->getStorage('user'); // Create a user. $account = $this->drupalCreateUser([]); @@ -95,7 +95,7 @@ public function testUserCancelChangePermission() { * administer the site. */ public function testUserCancelUid1() { - $user_storage = $this->container->get('entity.manager')->getStorage('user'); + $user_storage = $this->container->get('entity_type.manager')->getStorage('user'); \Drupal::service('module_installer')->install(['views']); \Drupal::service('router.builder')->rebuild(); @@ -119,9 +119,9 @@ public function testUserCancelUid1() { * Attempt invalid account cancellations. */ public function testUserCancelInvalid() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $this->config('user.settings')->set('cancel_method', 'user_cancel_reassign')->save(); - $user_storage = $this->container->get('entity.manager')->getStorage('user'); + $user_storage = $this->container->get('entity_type.manager')->getStorage('user'); // Create a user. $account = $this->drupalCreateUser(['cancel account']); @@ -168,7 +168,7 @@ public function testUserCancelInvalid() { */ public function testUserBlock() { $this->config('user.settings')->set('cancel_method', 'user_cancel_block')->save(); - $user_storage = $this->container->get('entity.manager')->getStorage('user'); + $user_storage = $this->container->get('entity_type.manager')->getStorage('user'); // Create a user. $web_user = $this->drupalCreateUser(['cancel account']); @@ -205,11 +205,11 @@ public function testUserBlock() { * Disable account and unpublish all content. */ public function testUserBlockUnpublish() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $this->config('user.settings')->set('cancel_method', 'user_cancel_block_unpublish')->save(); // Create comment field on page. $this->addDefaultCommentField('node', 'page'); - $user_storage = $this->container->get('entity.manager')->getStorage('user'); + $user_storage = $this->container->get('entity_type.manager')->getStorage('user'); // Create a user. $account = $this->drupalCreateUser(['cancel account']); @@ -278,11 +278,11 @@ public function testUserBlockUnpublish() { * Delete account and anonymize all content. */ public function testUserAnonymize() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $this->config('user.settings')->set('cancel_method', 'user_cancel_reassign')->save(); // Create comment field on page. $this->addDefaultCommentField('node', 'page'); - $user_storage = $this->container->get('entity.manager')->getStorage('user'); + $user_storage = $this->container->get('entity_type.manager')->getStorage('user'); // Create a user. $account = $this->drupalCreateUser(['cancel account']); @@ -359,9 +359,9 @@ public function testUserAnonymize() { * Delete account and anonymize all content using a batch process. */ public function testUserAnonymizeBatch() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $this->config('user.settings')->set('cancel_method', 'user_cancel_reassign')->save(); - $user_storage = $this->container->get('entity.manager')->getStorage('user'); + $user_storage = $this->container->get('entity_type.manager')->getStorage('user'); // Create a user. $account = $this->drupalCreateUser(['cancel account']); @@ -406,12 +406,12 @@ public function testUserAnonymizeBatch() { * Delete account and remove all content. */ public function testUserDelete() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $this->config('user.settings')->set('cancel_method', 'user_cancel_delete')->save(); \Drupal::service('module_installer')->install(['comment']); $this->resetAll(); $this->addDefaultCommentField('node', 'page'); - $user_storage = $this->container->get('entity.manager')->getStorage('user'); + $user_storage = $this->container->get('entity_type.manager')->getStorage('user'); // Create a user. $account = $this->drupalCreateUser(['cancel account', 'post comments', 'skip comment approval']); @@ -534,7 +534,7 @@ public function testMassUserCancelByAdmin() { \Drupal::service('module_installer')->install(['views']); \Drupal::service('router.builder')->rebuild(); $this->config('user.settings')->set('cancel_method', 'user_cancel_reassign')->save(); - $user_storage = $this->container->get('entity.manager')->getStorage('user'); + $user_storage = $this->container->get('entity_type.manager')->getStorage('user'); // Enable account cancellation notification. $this->config('user.settings')->set('notify.status_canceled', TRUE)->save(); diff --git a/core/modules/user/tests/src/Functional/UserLoginTest.php b/core/modules/user/tests/src/Functional/UserLoginTest.php index 7f810e064c8f..e9c88b106f65 100644 --- a/core/modules/user/tests/src/Functional/UserLoginTest.php +++ b/core/modules/user/tests/src/Functional/UserLoginTest.php @@ -122,7 +122,7 @@ public function testPasswordRehashOnLogin() { $this->drupalLogin($account); $this->drupalLogout(); // Load the stored user. The password hash should reflect $default_count_log2. - $user_storage = $this->container->get('entity.manager')->getStorage('user'); + $user_storage = $this->container->get('entity_type.manager')->getStorage('user'); $account = User::load($account->id()); $this->assertIdentical($password_hasher->getCountLog2($account->getPassword()), $default_count_log2); diff --git a/core/modules/user/tests/src/Functional/UserPermissionsTest.php b/core/modules/user/tests/src/Functional/UserPermissionsTest.php index 30ff65648e8c..14b0ca854e6a 100644 --- a/core/modules/user/tests/src/Functional/UserPermissionsTest.php +++ b/core/modules/user/tests/src/Functional/UserPermissionsTest.php @@ -45,7 +45,7 @@ protected function setUp() { public function testUserPermissionChanges() { $permissions_hash_generator = $this->container->get('user_permissions_hash_generator'); - $storage = $this->container->get('entity.manager')->getStorage('user_role'); + $storage = $this->container->get('entity_type.manager')->getStorage('user_role'); // Create an additional role and mark it as admin role. Role::create(['is_admin' => TRUE, 'id' => 'administrator', 'label' => 'Administrator'])->save(); diff --git a/core/modules/user/tests/src/Functional/UserPictureTest.php b/core/modules/user/tests/src/Functional/UserPictureTest.php index d24d788684c2..7e6cca79a78b 100644 --- a/core/modules/user/tests/src/Functional/UserPictureTest.php +++ b/core/modules/user/tests/src/Functional/UserPictureTest.php @@ -147,7 +147,7 @@ public function saveUserPicture($image) { $this->drupalPostForm('user/' . $this->webUser->id() . '/edit', $edit, t('Save')); // Load actual user data from database. - $user_storage = $this->container->get('entity.manager')->getStorage('user'); + $user_storage = $this->container->get('entity_type.manager')->getStorage('user'); $user_storage->resetCache([$this->webUser->id()]); $account = $user_storage->load($this->webUser->id()); return File::load($account->user_picture->target_id); diff --git a/core/modules/user/tests/src/Functional/UserRegistrationTest.php b/core/modules/user/tests/src/Functional/UserRegistrationTest.php index ce1568d83873..766baf304c2a 100644 --- a/core/modules/user/tests/src/Functional/UserRegistrationTest.php +++ b/core/modules/user/tests/src/Functional/UserRegistrationTest.php @@ -57,7 +57,7 @@ public function testRegistrationWithEmailVerification() { $edit['name'] = $name = $this->randomMachineName(); $edit['mail'] = $mail = $edit['name'] . '@example.com'; $this->drupalPostForm('user/register', $edit, t('Create new account')); - $this->container->get('entity.manager')->getStorage('user')->resetCache(); + $this->container->get('entity_type.manager')->getStorage('user')->resetCache(); $accounts = $storage->loadByProperties(['name' => $name, 'mail' => $mail]); $new_user = reset($accounts); $this->assertFalse($new_user->isActive(), 'New account is blocked until approved by an administrator.'); @@ -86,7 +86,7 @@ public function testRegistrationWithoutEmailVerification() { $edit['pass[pass1]'] = $new_pass = $this->randomMachineName(); $edit['pass[pass2]'] = $new_pass; $this->drupalPostForm('user/register', $edit, t('Create new account')); - $this->container->get('entity.manager')->getStorage('user')->resetCache(); + $this->container->get('entity_type.manager')->getStorage('user')->resetCache(); $accounts = $this->container->get('entity_type.manager')->getStorage('user') ->loadByProperties(['name' => $name, 'mail' => $mail]); $new_user = reset($accounts); diff --git a/core/modules/user/tests/src/Functional/UserRolesAssignmentTest.php b/core/modules/user/tests/src/Functional/UserRolesAssignmentTest.php index c0ee2d172796..6cd80562c540 100644 --- a/core/modules/user/tests/src/Functional/UserRolesAssignmentTest.php +++ b/core/modules/user/tests/src/Functional/UserRolesAssignmentTest.php @@ -80,7 +80,7 @@ public function testCreateUserWithRole() { * Defaults to TRUE. */ private function userLoadAndCheckRoleAssigned($account, $rid, $is_assigned = TRUE) { - $user_storage = $this->container->get('entity.manager')->getStorage('user'); + $user_storage = $this->container->get('entity_type.manager')->getStorage('user'); $user_storage->resetCache([$account->id()]); $account = $user_storage->load($account->id()); if ($is_assigned) { diff --git a/core/modules/user/tests/src/Functional/Views/BulkFormTest.php b/core/modules/user/tests/src/Functional/Views/BulkFormTest.php index 29c0e83e6b9d..a9ba63feed6b 100644 --- a/core/modules/user/tests/src/Functional/Views/BulkFormTest.php +++ b/core/modules/user/tests/src/Functional/Views/BulkFormTest.php @@ -34,7 +34,7 @@ class BulkFormTest extends UserTestBase { public function testBulkForm() { // Log in as a user without 'administer users'. $this->drupalLogin($this->drupalCreateUser(['administer permissions'])); - $user_storage = $this->container->get('entity.manager')->getStorage('user'); + $user_storage = $this->container->get('entity_type.manager')->getStorage('user'); // Create an user which actually can change users. $this->drupalLogin($this->drupalCreateUser(['administer users'])); diff --git a/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php b/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php index fe967b2d9f6f..2e44cf4c251e 100644 --- a/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php +++ b/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php @@ -132,10 +132,10 @@ protected function buildAccountForm($operation) { if ($operation != 'register') { $fields['uid'] = 2; } - $entity = $this->container->get('entity.manager') + $entity = $this->container->get('entity_type.manager') ->getStorage($entity_type) ->create($fields); - $this->container->get('entity.manager') + $this->container->get('entity_type.manager') ->getFormObject($entity_type, $operation) ->setEntity($entity); diff --git a/core/modules/user/tests/src/Kernel/UserEntityTest.php b/core/modules/user/tests/src/Kernel/UserEntityTest.php index 73fe869ec3d4..6d96172ccebb 100644 --- a/core/modules/user/tests/src/Kernel/UserEntityTest.php +++ b/core/modules/user/tests/src/Kernel/UserEntityTest.php @@ -37,7 +37,7 @@ protected function setUp() { * @see \Drupal\user\Entity\User::removeRole() */ public function testUserMethods() { - $role_storage = $this->container->get('entity.manager')->getStorage('user_role'); + $role_storage = $this->container->get('entity_type.manager')->getStorage('user_role'); $role_storage->create(['id' => 'test_role_one'])->save(); $role_storage->create(['id' => 'test_role_two'])->save(); $role_storage->create(['id' => 'test_role_three'])->save(); diff --git a/core/modules/user/tests/src/Kernel/UserRoleDeleteTest.php b/core/modules/user/tests/src/Kernel/UserRoleDeleteTest.php index cac470aaab84..4fa03df04cdf 100644 --- a/core/modules/user/tests/src/Kernel/UserRoleDeleteTest.php +++ b/core/modules/user/tests/src/Kernel/UserRoleDeleteTest.php @@ -31,7 +31,7 @@ protected function setUp() { */ public function testRoleDeleteUserRoleReferenceDelete() { // Create two test roles. - $role_storage = $this->container->get('entity.manager')->getStorage('user_role'); + $role_storage = $this->container->get('entity_type.manager')->getStorage('user_role'); $role_storage->create(['id' => 'test_role_one'])->save(); $role_storage->create(['id' => 'test_role_two'])->save(); diff --git a/core/modules/user/tests/src/Kernel/Views/UserKernelTestBase.php b/core/modules/user/tests/src/Kernel/Views/UserKernelTestBase.php index 0e862c86b897..c788cafbecf6 100644 --- a/core/modules/user/tests/src/Kernel/Views/UserKernelTestBase.php +++ b/core/modules/user/tests/src/Kernel/Views/UserKernelTestBase.php @@ -45,9 +45,9 @@ protected function setUp($import_test_views = TRUE) { $this->installEntitySchema('user'); - $entity_manager = $this->container->get('entity.manager'); - $this->roleStorage = $entity_manager->getStorage('user_role'); - $this->userStorage = $entity_manager->getStorage('user'); + $entity_type_manager = $this->container->get('entity_type.manager'); + $this->roleStorage = $entity_type_manager->getStorage('user_role'); + $this->userStorage = $entity_type_manager->getStorage('user'); } /** diff --git a/core/modules/user/tests/src/Unit/Views/Argument/RolesRidTest.php b/core/modules/user/tests/src/Unit/Views/Argument/RolesRidTest.php index ff4a53e0e960..53beacb0ce18 100644 --- a/core/modules/user/tests/src/Unit/Views/Argument/RolesRidTest.php +++ b/core/modules/user/tests/src/Unit/Views/Argument/RolesRidTest.php @@ -3,7 +3,6 @@ namespace Drupal\Tests\user\Unit\Views\Argument; use Drupal\Core\DependencyInjection\ContainerBuilder; -use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Tests\UnitTestCase; use Drupal\user\Entity\Role; @@ -53,7 +52,6 @@ public function testTitleQuery() { ->with('label') ->will($this->returnValue('label')); - $entity_manager = new EntityManager(); $entity_type_manager = $this->getMock(EntityTypeManagerInterface::class); $entity_type_manager->expects($this->any()) ->method('getDefinition') @@ -69,14 +67,10 @@ public function testTitleQuery() { // Set up a minimal container to satisfy Drupal\Core\Entity\EntityBase's // dependency on it. $container = new ContainerBuilder(); - $container->set('entity.manager', $entity_manager); $container->set('entity_type.manager', $entity_type_manager); - // Inject the container into entity.manager so it can defer to - // entity_type.manager. - $entity_manager->setContainer($container); \Drupal::setContainer($container); - $roles_rid_argument = new RolesRid([], 'user__roles_rid', [], $entity_manager); + $roles_rid_argument = new RolesRid([], 'user__roles_rid', [], $entity_type_manager); $roles_rid_argument->value = []; $titles = $roles_rid_argument->titleQuery(); diff --git a/core/modules/views/src/Controller/ViewAjaxController.php b/core/modules/views/src/Controller/ViewAjaxController.php index 88ad2b52bd7c..1bc6e3e367c3 100644 --- a/core/modules/views/src/Controller/ViewAjaxController.php +++ b/core/modules/views/src/Controller/ViewAjaxController.php @@ -90,7 +90,7 @@ public function __construct(EntityStorageInterface $storage, ViewExecutableFacto */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager')->getStorage('view'), + $container->get('entity_type.manager')->getStorage('view'), $container->get('views.executable'), $container->get('renderer'), $container->get('path.current'), diff --git a/core/modules/views/src/Plugin/Block/ViewsBlockBase.php b/core/modules/views/src/Plugin/Block/ViewsBlockBase.php index 4b7d86d27293..26dbf5be86c7 100644 --- a/core/modules/views/src/Plugin/Block/ViewsBlockBase.php +++ b/core/modules/views/src/Plugin/Block/ViewsBlockBase.php @@ -81,7 +81,7 @@ public static function create(ContainerInterface $container, array $configuratio return new static( $configuration, $plugin_id, $plugin_definition, $container->get('views.executable'), - $container->get('entity.manager')->getStorage('view'), + $container->get('entity_type.manager')->getStorage('view'), $container->get('current_user') ); } diff --git a/core/modules/views/src/Plugin/Derivative/ViewsBlock.php b/core/modules/views/src/Plugin/Derivative/ViewsBlock.php index 51993ae40213..4d9d0f23f5f7 100644 --- a/core/modules/views/src/Plugin/Derivative/ViewsBlock.php +++ b/core/modules/views/src/Plugin/Derivative/ViewsBlock.php @@ -41,7 +41,7 @@ class ViewsBlock implements ContainerDeriverInterface { public static function create(ContainerInterface $container, $base_plugin_id) { return new static( $base_plugin_id, - $container->get('entity.manager')->getStorage('view') + $container->get('entity_type.manager')->getStorage('view') ); } diff --git a/core/modules/views/src/Plugin/Derivative/ViewsEntityRow.php b/core/modules/views/src/Plugin/Derivative/ViewsEntityRow.php index bdbeacc35c84..85ca1c46d9bb 100644 --- a/core/modules/views/src/Plugin/Derivative/ViewsEntityRow.php +++ b/core/modules/views/src/Plugin/Derivative/ViewsEntityRow.php @@ -73,7 +73,7 @@ public function __construct($base_plugin_id, EntityTypeManagerInterface $entity_ public static function create(ContainerInterface $container, $base_plugin_id) { return new static( $base_plugin_id, - $container->get('entity.manager'), + $container->get('entity_type.manager'), $container->get('views.views_data') ); } diff --git a/core/modules/views/src/Plugin/Derivative/ViewsExposedFilterBlock.php b/core/modules/views/src/Plugin/Derivative/ViewsExposedFilterBlock.php index f700f16aceb5..0dcf62ee3d35 100644 --- a/core/modules/views/src/Plugin/Derivative/ViewsExposedFilterBlock.php +++ b/core/modules/views/src/Plugin/Derivative/ViewsExposedFilterBlock.php @@ -53,7 +53,7 @@ public function __construct($base_plugin_id, EntityStorageInterface $view_storag public static function create(ContainerInterface $container, $base_plugin_id) { return new static( $base_plugin_id, - $container->get('entity.manager')->getStorage('view') + $container->get('entity_type.manager')->getStorage('view') ); } diff --git a/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php b/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php index bc6400c0189b..6bf6254d07d0 100644 --- a/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php +++ b/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php @@ -59,7 +59,7 @@ public static function create(ContainerInterface $container, $base_plugin_id) { return new static( $container->get('router.route_provider'), $container->get('state'), - $container->get('entity.manager')->getStorage('view') + $container->get('entity_type.manager')->getStorage('view') ); } diff --git a/core/modules/views/src/Plugin/Derivative/ViewsMenuLink.php b/core/modules/views/src/Plugin/Derivative/ViewsMenuLink.php index 40dfe44a205d..c73846514b0c 100644 --- a/core/modules/views/src/Plugin/Derivative/ViewsMenuLink.php +++ b/core/modules/views/src/Plugin/Derivative/ViewsMenuLink.php @@ -38,7 +38,7 @@ public function __construct(EntityStorageInterface $view_storage) { */ public static function create(ContainerInterface $container, $base_plugin_id) { return new static( - $container->get('entity.manager')->getStorage('view') + $container->get('entity_type.manager')->getStorage('view') ); } diff --git a/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php b/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php index 79707af10a28..6def8d8fefb6 100644 --- a/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php +++ b/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php @@ -41,7 +41,7 @@ class ViewsSelection extends SelectionPluginBase implements ContainerFactoryPlug /** * The entity type manager service. * - * @var \Drupal\Core\Entity\EntityManagerInterface + * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; diff --git a/core/modules/views/src/Plugin/Menu/ViewsMenuLink.php b/core/modules/views/src/Plugin/Menu/ViewsMenuLink.php index ab8c42ac2485..9ea7c51fe323 100644 --- a/core/modules/views/src/Plugin/Menu/ViewsMenuLink.php +++ b/core/modules/views/src/Plugin/Menu/ViewsMenuLink.php @@ -85,7 +85,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager'), + $container->get('entity_type.manager'), $container->get('views.executable') ); } diff --git a/core/modules/views/src/Plugin/views/area/View.php b/core/modules/views/src/Plugin/views/area/View.php index 27c8d4875886..932e7a6a2595 100644 --- a/core/modules/views/src/Plugin/views/area/View.php +++ b/core/modules/views/src/Plugin/views/area/View.php @@ -56,7 +56,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager')->getStorage('view') + $container->get('entity_type.manager')->getStorage('view') ); } diff --git a/core/modules/views/src/Plugin/views/display/Block.php b/core/modules/views/src/Plugin/views/display/Block.php index cf6d65a1f89f..bcdab29ecd3d 100644 --- a/core/modules/views/src/Plugin/views/display/Block.php +++ b/core/modules/views/src/Plugin/views/display/Block.php @@ -88,7 +88,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager'), + $container->get('entity_type.manager'), $container->get('plugin.manager.block') ); } diff --git a/core/modules/views/src/Plugin/views/display/Page.php b/core/modules/views/src/Plugin/views/display/Page.php index 23409ec56da0..3816ee179f11 100644 --- a/core/modules/views/src/Plugin/views/display/Page.php +++ b/core/modules/views/src/Plugin/views/display/Page.php @@ -80,7 +80,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_definition, $container->get('router.route_provider'), $container->get('state'), - $container->get('entity.manager')->getStorage('menu') + $container->get('entity_type.manager')->getStorage('menu') ); } diff --git a/core/modules/views/src/Plugin/views/field/BulkForm.php b/core/modules/views/src/Plugin/views/field/BulkForm.php index 33b1afb015a1..5ee5891d9dea 100644 --- a/core/modules/views/src/Plugin/views/field/BulkForm.php +++ b/core/modules/views/src/Plugin/views/field/BulkForm.php @@ -121,7 +121,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager'), + $container->get('entity_type.manager'), $container->get('language_manager'), $container->get('messenger'), $container->get('entity.repository') diff --git a/core/modules/views/src/Plugin/views/field/Date.php b/core/modules/views/src/Plugin/views/field/Date.php index aff879c5d53a..639bc2329afc 100644 --- a/core/modules/views/src/Plugin/views/field/Date.php +++ b/core/modules/views/src/Plugin/views/field/Date.php @@ -61,7 +61,7 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_id, $plugin_definition, $container->get('date.formatter'), - $container->get('entity.manager')->getStorage('date_format') + $container->get('entity_type.manager')->getStorage('date_format') ); } diff --git a/core/modules/views/src/Plugin/views/field/EntityLabel.php b/core/modules/views/src/Plugin/views/field/EntityLabel.php index 86ccd05449a4..9d7dbfe6f980 100644 --- a/core/modules/views/src/Plugin/views/field/EntityLabel.php +++ b/core/modules/views/src/Plugin/views/field/EntityLabel.php @@ -3,7 +3,7 @@ namespace Drupal\views\Plugin\views\field; use Drupal\Core\Entity\EntityMalformedException; -use Drupal\Core\Entity\EntityManagerInterface; +use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException; use Drupal\Core\Form\FormStateInterface; use Drupal\views\ResultRow; @@ -26,11 +26,11 @@ class EntityLabel extends FieldPluginBase { protected $loadedReferencers = []; /** - * EntityManager class. + * EntityTypeManager class. * - * @var \Drupal\Core\Entity\EntityManagerInterface + * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ - protected $entityManager; + protected $entityTypeManager; /** * Constructs a EntityLabel object. @@ -41,13 +41,13 @@ class EntityLabel extends FieldPluginBase { * The plugin_id for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. - * @param \Drupal\Core\Entity\EntityManagerInterface $manager - * EntityManager that is stored internally and used to load nodes. + * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager + * The entity type manager. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $manager) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) { parent::__construct($configuration, $plugin_id, $plugin_definition); - $this->entityManager = $manager; + $this->entityTypeManager = $entity_type_manager; } /** @@ -58,7 +58,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager') + $container->get('entity_type.manager') ); } @@ -136,7 +136,7 @@ public function preRender(&$values) { } foreach ($entity_ids_per_type as $type => $ids) { - $this->loadedReferencers[$type] = $this->entityManager->getStorage($type)->loadMultiple($ids); + $this->loadedReferencers[$type] = $this->entityTypeManager->getStorage($type)->loadMultiple($ids); } } diff --git a/core/modules/views/src/Plugin/views/filter/Bundle.php b/core/modules/views/src/Plugin/views/filter/Bundle.php index 29e9ac5b32af..147e26104ae3 100644 --- a/core/modules/views/src/Plugin/views/filter/Bundle.php +++ b/core/modules/views/src/Plugin/views/filter/Bundle.php @@ -81,7 +81,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager'), + $container->get('entity_type.manager'), $container->get('entity_type.bundle.info') ); } diff --git a/core/modules/views/src/Views.php b/core/modules/views/src/Views.php index 32cf016fd411..d34380c0787d 100644 --- a/core/modules/views/src/Views.php +++ b/core/modules/views/src/Views.php @@ -119,7 +119,7 @@ public static function handlerManager($type) { * A view executable instance, from the loaded entity. */ public static function getView($id) { - $view = \Drupal::service('entity.manager')->getStorage('view')->load($id); + $view = \Drupal::entityTypeManager()->getStorage('view')->load($id); if ($view) { return static::executableFactory()->get($view); } diff --git a/core/modules/views/tests/src/Functional/BulkFormTest.php b/core/modules/views/tests/src/Functional/BulkFormTest.php index 278a1ec7b9d5..86b0d941f85f 100644 --- a/core/modules/views/tests/src/Functional/BulkFormTest.php +++ b/core/modules/views/tests/src/Functional/BulkFormTest.php @@ -24,7 +24,7 @@ class BulkFormTest extends BrowserTestBase { * Tests the bulk form. */ public function testBulkForm() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); // First, test an empty bulk form with the default style plugin to make sure // the empty region is rendered correctly. diff --git a/core/modules/views/tests/src/Functional/DefaultViewsTest.php b/core/modules/views/tests/src/Functional/DefaultViewsTest.php index a4ae23aa487c..76bcc80fd20c 100644 --- a/core/modules/views/tests/src/Functional/DefaultViewsTest.php +++ b/core/modules/views/tests/src/Functional/DefaultViewsTest.php @@ -121,7 +121,7 @@ protected function setUp($import_test_views = TRUE) { */ public function testDefaultViews() { // Get all default views. - $controller = $this->container->get('entity.manager')->getStorage('view'); + $controller = $this->container->get('entity_type.manager')->getStorage('view'); $views = $controller->loadMultiple(); foreach ($views as $name => $view_storage) { diff --git a/core/modules/views/tests/src/Functional/Plugin/CacheTagTest.php b/core/modules/views/tests/src/Functional/Plugin/CacheTagTest.php index 1d78204db9a9..32081addb25e 100644 --- a/core/modules/views/tests/src/Functional/Plugin/CacheTagTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/CacheTagTest.php @@ -77,9 +77,9 @@ protected function setUp($import_test_views = TRUE) { $this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']); $this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']); - $this->nodeStorage = $this->container->get('entity.manager')->getStorage('node'); - $this->nodeViewBuilder = $this->container->get('entity.manager')->getViewBuilder('node'); - $this->userViewBuilder = $this->container->get('entity.manager')->getViewBuilder('user'); + $this->nodeStorage = $this->container->get('entity_type.manager')->getStorage('node'); + $this->nodeViewBuilder = $this->container->get('entity_type.manager')->getViewBuilder('node'); + $this->userViewBuilder = $this->container->get('entity_type.manager')->getViewBuilder('user'); for ($i = 1; $i <= 5; $i++) { $this->pages[] = $this->drupalCreateNode(['title' => "Test $i", 'type' => 'page']); diff --git a/core/modules/views/tests/src/Functional/Plugin/DisabledDisplayTest.php b/core/modules/views/tests/src/Functional/Plugin/DisabledDisplayTest.php index 708ac5503037..a85612cca282 100644 --- a/core/modules/views/tests/src/Functional/Plugin/DisabledDisplayTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/DisabledDisplayTest.php @@ -52,7 +52,7 @@ public function testDisabledDisplays() { $this->drupalCreateNode(); // Load the test view and initialize its displays. - $view = $this->container->get('entity.manager')->getStorage('view')->load('test_disabled_display'); + $view = $this->container->get('entity_type.manager')->getStorage('view')->load('test_disabled_display'); $view->getExecutable()->setDisplay(); // Enabled page display should return content. diff --git a/core/modules/views/tests/src/Functional/Plugin/DisplayFeedTest.php b/core/modules/views/tests/src/Functional/Plugin/DisplayFeedTest.php index 6599a4416fd6..94baae3dea12 100644 --- a/core/modules/views/tests/src/Functional/Plugin/DisplayFeedTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/DisplayFeedTest.php @@ -64,7 +64,7 @@ public function testFeedOutput() { // Verify HTML is properly escaped in the description field. $this->assertRaw('<p>A paragraph</p>'); - $view = $this->container->get('entity.manager')->getStorage('view')->load('test_display_feed'); + $view = $this->container->get('entity_type.manager')->getStorage('view')->load('test_display_feed'); $display = &$view->getDisplay('feed_1'); $display['display_options']['sitename_title'] = 0; $view->save(); diff --git a/core/modules/views/tests/src/Functional/Plugin/StyleOpmlTest.php b/core/modules/views/tests/src/Functional/Plugin/StyleOpmlTest.php index bf0f2a1adba8..90f027c7f50a 100644 --- a/core/modules/views/tests/src/Functional/Plugin/StyleOpmlTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/StyleOpmlTest.php @@ -48,7 +48,7 @@ public function testOpmlOutput() { 'url' => 'http://example.com/rss.xml', 'refresh' => '900', ]; - $feed = $this->container->get('entity.manager') + $feed = $this->container->get('entity_type.manager') ->getStorage('aggregator_feed') ->create($values); $feed->save(); @@ -59,7 +59,7 @@ public function testOpmlOutput() { $this->assertEquals($feed->label(), $outline->getAttribute('text')); $this->assertEquals($feed->getUrl(), $outline->getAttribute('xmlUrl')); - $view = $this->container->get('entity.manager') + $view = $this->container->get('entity_type.manager') ->getStorage('view') ->load('test_style_opml'); $display = &$view->getDisplay('feed_1'); diff --git a/core/modules/views/tests/src/Kernel/Handler/AreaEntityTest.php b/core/modules/views/tests/src/Kernel/Handler/AreaEntityTest.php index 0d3ce325d44d..1cc6ea80793c 100644 --- a/core/modules/views/tests/src/Kernel/Handler/AreaEntityTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/AreaEntityTest.php @@ -62,7 +62,7 @@ protected function setUpFixtures() { */ public function testEntityAreaData() { $data = $this->container->get('views.views_data')->get('views'); - $entity_types = $this->container->get('entity.manager')->getDefinitions(); + $entity_types = $this->container->get('entity_type.manager')->getDefinitions(); $expected_entities = array_filter($entity_types, function (EntityTypeInterface $entity_type) { return $entity_type->hasViewBuilderClass(); @@ -94,7 +94,7 @@ public function testEntityArea() { for ($i = 0; $i < 3; $i++) { $random_label = $this->randomMachineName(); $data = ['bundle' => 'entity_test', 'name' => $random_label]; - $entity_test = $this->container->get('entity.manager') + $entity_test = $this->container->get('entity_type.manager') ->getStorage('entity_test') ->create($data); diff --git a/core/modules/views/tests/src/Kernel/ModuleTest.php b/core/modules/views/tests/src/Kernel/ModuleTest.php index 3ea46f0dd06f..a05558f8e1a4 100644 --- a/core/modules/views/tests/src/Kernel/ModuleTest.php +++ b/core/modules/views/tests/src/Kernel/ModuleTest.php @@ -141,7 +141,7 @@ public function testLoadFunctions() { $this->enableModules(['text', 'node']); $this->installEntitySchema('node'); $this->installConfig(['node']); - $storage = $this->container->get('entity.manager')->getStorage('view'); + $storage = $this->container->get('entity_type.manager')->getStorage('view'); // Test views_view_is_enabled/disabled. $archive = $storage->load('archive'); diff --git a/core/modules/views/tests/src/Kernel/Plugin/Display/ViewsMenuLinkTest.php b/core/modules/views/tests/src/Kernel/Plugin/Display/ViewsMenuLinkTest.php index a6776b585a1f..f24e956032b2 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/Display/ViewsMenuLinkTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/Display/ViewsMenuLinkTest.php @@ -25,13 +25,6 @@ class ViewsMenuLinkTest extends ViewsKernelTestBase { */ public static $testViews = ['test_page_display_menu']; - /** - * The entity manager. - * - * @var \Drupal\Core\Entity\EntityManagerInterface - */ - protected $entityManager; - /** * The menu link manager. * @@ -52,7 +45,6 @@ class ViewsMenuLinkTest extends ViewsKernelTestBase { protected function setUp($import_test_views = TRUE) { parent::setUp($import_test_views); - $this->entityManager = $this->container->get('entity.manager'); $this->menuLinkManager = $this->container->get('plugin.manager.menu.link'); $this->menuLinkOverrides = $this->container->get('menu_link.static.overrides'); } diff --git a/core/modules/views/tests/src/Kernel/QueryGroupByTest.php b/core/modules/views/tests/src/Kernel/QueryGroupByTest.php index 25d8b4a4c1dc..256192ba1eaf 100644 --- a/core/modules/views/tests/src/Kernel/QueryGroupByTest.php +++ b/core/modules/views/tests/src/Kernel/QueryGroupByTest.php @@ -46,7 +46,7 @@ protected function setUp($import_test_views = TRUE) { $this->installEntitySchema('entity_test'); $this->installEntitySchema('entity_test_mul'); - $this->storage = $this->container->get('entity.manager')->getStorage('entity_test'); + $this->storage = $this->container->get('entity_type.manager')->getStorage('entity_test'); ConfigurableLanguage::createFromLangcode('it')->save(); } diff --git a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php index cb548c0afbaf..44036c6b0a38 100644 --- a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php +++ b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php @@ -261,7 +261,7 @@ public function testDisplays() { $this->assertTrue($view->rowPlugin instanceof Fields); // Test the newDisplay() method. - $view = $this->container->get('entity.manager')->getStorage('view')->create(['id' => 'test_executable_displays']); + $view = $this->container->get('entity_type.manager')->getStorage('view')->create(['id' => 'test_executable_displays']); $executable = $view->getExecutable(); $executable->newDisplay('page'); diff --git a/core/modules/views/tests/src/Kernel/ViewStorageTest.php b/core/modules/views/tests/src/Kernel/ViewStorageTest.php index b60df267b34a..b192048d9134 100644 --- a/core/modules/views/tests/src/Kernel/ViewStorageTest.php +++ b/core/modules/views/tests/src/Kernel/ViewStorageTest.php @@ -60,7 +60,7 @@ class ViewStorageTest extends ViewsKernelTestBase { public function testConfigurationEntityCRUD() { // Get the configuration entity type and controller. $this->entityType = \Drupal::entityTypeManager()->getDefinition('view'); - $this->controller = $this->container->get('entity.manager')->getStorage('view'); + $this->controller = $this->container->get('entity_type.manager')->getStorage('view'); // Confirm that an info array has been returned. $this->assertTrue($this->entityType instanceof EntityTypeInterface, 'The View info array is loaded.'); diff --git a/core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php b/core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php index fb19ac1be5c7..be0a70c3d10b 100644 --- a/core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php @@ -25,7 +25,7 @@ class EntityTest extends UnitTestCase { /** * The mocked entity type manager. * - * @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $entityTypeManager; @@ -125,7 +125,7 @@ protected function setUp() { /** * Ensures that the entity manager returns an entity storage. */ - protected function setupEntityManager() { + protected function setupEntityTypeManager() { $this->entityTypeManager->expects($this->any()) ->method('getStorage') ->with('entity_test') @@ -156,7 +156,7 @@ public function providerTestTokens() { * @covers ::init */ public function testRenderWithId() { - $this->setupEntityManager(); + $this->setupEntityTypeManager(); $options = [ 'target' => 1, 'tokenize' => FALSE, @@ -192,7 +192,7 @@ public function testRenderWithId() { * @dataProvider providerTestTokens */ public function testRenderWithIdAndToken($token, $id) { - $this->setupEntityManager(); + $this->setupEntityTypeManager(); $options = [ 'target' => $token, 'tokenize' => TRUE, @@ -231,7 +231,7 @@ public function testRenderWithIdAndToken($token, $id) { * @covers ::init */ public function testRenderWithUuid() { - $this->setupEntityManager(); + $this->setupEntityTypeManager(); $uuid = '1d52762e-b9d8-4177-908f-572d1a5845a4'; $options = [ 'target' => $uuid, @@ -264,7 +264,7 @@ public function testRenderWithUuid() { * @dataProvider providerTestTokens */ public function testCalculateDependenciesWithPlaceholder($token, $id) { - $this->setupEntityManager(); + $this->setupEntityTypeManager(); $options = [ 'target' => $token, @@ -278,7 +278,7 @@ public function testCalculateDependenciesWithPlaceholder($token, $id) { * @covers ::calculateDependencies */ public function testCalculateDependenciesWithUuid() { - $this->setupEntityManager(); + $this->setupEntityTypeManager(); $uuid = '1d52762e-b9d8-4177-908f-572d1a5845a4'; $entity = $this->getMock('Drupal\Core\Entity\EntityInterface'); @@ -310,7 +310,7 @@ public function testCalculateDependenciesWithUuid() { * @covers ::calculateDependencies */ public function testCalculateDependenciesWithEntityId() { - $this->setupEntityManager(); + $this->setupEntityTypeManager(); $entity = $this->getMock('Drupal\Core\Entity\EntityInterface'); $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface'); diff --git a/core/modules/views/tests/src/Unit/ViewsTest.php b/core/modules/views/tests/src/Unit/ViewsTest.php index e94068f051f2..0273fb2bccd9 100644 --- a/core/modules/views/tests/src/Unit/ViewsTest.php +++ b/core/modules/views/tests/src/Unit/ViewsTest.php @@ -59,12 +59,12 @@ public function testGetView() { ->with('test_view') ->will($this->returnValue($view)); - $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface'); - $entity_manager->expects($this->once()) + $entity_type_manager = $this->createMock('Drupal\Core\Entity\EntityTypeManagerInterface'); + $entity_type_manager->expects($this->once()) ->method('getStorage') ->with('view') ->will($this->returnValue($view_storage)); - $this->container->set('entity.manager', $entity_manager); + $this->container->set('entity_type.manager', $entity_type_manager); $executable = Views::getView('test_view'); $this->assertInstanceOf('Drupal\views\ViewExecutable', $executable); diff --git a/core/modules/views_ui/tests/src/Functional/GroupByTest.php b/core/modules/views_ui/tests/src/Functional/GroupByTest.php index 4a45d85feef1..6a348b70d4a1 100644 --- a/core/modules/views_ui/tests/src/Functional/GroupByTest.php +++ b/core/modules/views_ui/tests/src/Functional/GroupByTest.php @@ -41,7 +41,7 @@ public function testGroupBySave() { $this->drupalPostForm(NULL, [], t('Save')); - $view = $this->container->get('entity.manager')->getStorage('view')->load('test_views_groupby_save'); + $view = $this->container->get('entity_type.manager')->getStorage('view')->load('test_views_groupby_save'); $display = $view->getDisplay('default'); $this->assertTrue($display['display_options']['group_by'], 'The groupby setting was saved on the view.'); $this->assertEqual($display['display_options']['fields']['id']['group_type'], 'count', 'Count groupby_type was saved on the view.'); diff --git a/core/modules/views_ui/tests/src/Functional/HandlerTest.php b/core/modules/views_ui/tests/src/Functional/HandlerTest.php index 7d96d0c5b57a..e37c61f4665e 100644 --- a/core/modules/views_ui/tests/src/Functional/HandlerTest.php +++ b/core/modules/views_ui/tests/src/Functional/HandlerTest.php @@ -125,7 +125,7 @@ public function testUICRUD() { // Save the view and have a look whether the handler was added as expected. $this->drupalPostForm(NULL, [], t('Save')); - $view = $this->container->get('entity.manager')->getStorage('view')->load('test_view_empty'); + $view = $this->container->get('entity_type.manager')->getStorage('view')->load('test_view_empty'); $display = $view->getDisplay('default'); $this->assertTrue(isset($display['display_options'][$type_info['plural']][$id]), 'Ensure the field was added to the view itself.'); @@ -134,7 +134,7 @@ public function testUICRUD() { $this->assertNoLinkByHref($edit_handler_url, 0, 'The handler edit link does not appears in the UI after removing.'); $this->drupalPostForm(NULL, [], t('Save')); - $view = $this->container->get('entity.manager')->getStorage('view')->load('test_view_empty'); + $view = $this->container->get('entity_type.manager')->getStorage('view')->load('test_view_empty'); $display = $view->getDisplay('default'); $this->assertFalse(isset($display['display_options'][$type_info['plural']][$id]), 'Ensure the field was removed from the view itself.'); } @@ -155,7 +155,7 @@ public function testUICRUD() { $this->drupalPostForm(NULL, [], t('Apply')); $this->drupalPostForm(NULL, [], t('Save')); - $view = $this->container->get('entity.manager')->getStorage('view')->load('test_view_empty'); + $view = $this->container->get('entity_type.manager')->getStorage('view')->load('test_view_empty'); $display = $view->getDisplay('default'); $this->assertTrue(isset($display['display_options'][$type_info['plural']][$id]), 'Ensure the field was added to the view itself.'); } diff --git a/core/modules/views_ui/tests/src/Functional/ViewEditTest.php b/core/modules/views_ui/tests/src/Functional/ViewEditTest.php index bfe5b05d071f..645bac54a817 100644 --- a/core/modules/views_ui/tests/src/Functional/ViewEditTest.php +++ b/core/modules/views_ui/tests/src/Functional/ViewEditTest.php @@ -26,7 +26,7 @@ public function testDeleteLink() { $this->drupalGet('admin/structure/views/view/test_view'); $this->assertLink(t('Delete view'), 0, 'Ensure that the view delete link appears'); - $view = $this->container->get('entity.manager')->getStorage('view')->load('test_view'); + $view = $this->container->get('entity_type.manager')->getStorage('view')->load('test_view'); $this->assertTrue($view instanceof View); $this->clickLink(t('Delete view')); $this->assertUrl('admin/structure/views/view/test_view/delete'); @@ -34,7 +34,7 @@ public function testDeleteLink() { $this->assertRaw(t('The view %name has been deleted.', ['%name' => $view->label()])); $this->assertUrl('admin/structure/views'); - $view = $this->container->get('entity.manager')->getStorage('view')->load('test_view'); + $view = $this->container->get('entity_type.manager')->getStorage('view')->load('test_view'); $this->assertFalse($view instanceof View); } diff --git a/core/tests/Drupal/KernelTests/Core/Config/CacheabilityMetadataConfigOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Config/CacheabilityMetadataConfigOverrideTest.php index 4ceebf5b9b32..7f3e44bb4045 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/CacheabilityMetadataConfigOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/CacheabilityMetadataConfigOverrideTest.php @@ -63,9 +63,9 @@ public function testConfigEntityOverride() { // Load the User login block and check that its cacheability metadata is // overridden correctly. This verifies that the metadata is correctly // applied to config entities. - /** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */ - $entity_manager = $this->container->get('entity.manager'); - $block = $entity_manager->getStorage('block')->load('call_to_action'); + /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */ + $entity_type_manager = $this->container->get('entity_type.manager'); + $block = $entity_type_manager->getStorage('block')->load('call_to_action'); // Check that our call to action message is appealing to filibusters. $this->assertEqual($block->label(), 'Draw yer cutlasses!'); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php index e9259c52e81d..2889d9d65f96 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php @@ -43,7 +43,7 @@ public function testNonEntity() { public function testDependencyManagement() { /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */ $config_manager = \Drupal::service('config.manager'); - $storage = $this->container->get('entity.manager')->getStorage('config_test'); + $storage = $this->container->get('entity_type.manager')->getStorage('config_test'); // Test dependencies between modules. $entity1 = $storage->create( [ @@ -126,7 +126,7 @@ public function testDependencyManagement() { // Create a configuration entity of a different type with the same ID as one // of the entities already created. - $alt_storage = $this->container->get('entity.manager')->getStorage('config_query_test'); + $alt_storage = $this->container->get('entity_type.manager')->getStorage('config_query_test'); $alt_storage->create(['id' => 'entity1', 'dependencies' => ['enforced' => ['config' => [$entity1->getConfigDependencyName()]]]])->save(); $alt_storage->create(['id' => 'entity2', 'dependencies' => ['enforced' => ['module' => ['views']]]])->save(); @@ -192,7 +192,7 @@ public function testConfigEntityUninstall() { /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */ $config_manager = \Drupal::service('config.manager'); /** @var \Drupal\Core\Config\Entity\ConfigEntityStorage $storage */ - $storage = $this->container->get('entity.manager') + $storage = $this->container->get('entity_type.manager') ->getStorage('config_test'); // Test dependencies between modules. $entity1 = $storage->create( @@ -256,7 +256,7 @@ public function testConfigEntityUninstallComplex(array $entity_id_suffixes) { /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */ $config_manager = \Drupal::service('config.manager'); /** @var \Drupal\Core\Config\Entity\ConfigEntityStorage $storage */ - $storage = $this->container->get('entity.manager') + $storage = $this->container->get('entity_type.manager') ->getStorage('config_test'); // Entity 1 will be deleted because it depends on node. $entity_1 = $storage->create( @@ -504,7 +504,7 @@ public function testConfigEntityDelete() { /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */ $config_manager = \Drupal::service('config.manager'); /** @var \Drupal\Core\Config\Entity\ConfigEntityStorage $storage */ - $storage = $this->container->get('entity.manager')->getStorage('config_test'); + $storage = $this->container->get('entity_type.manager')->getStorage('config_test'); // Test dependencies between configuration entities. $entity1 = $storage->create( [ @@ -615,7 +615,7 @@ public function testContentEntityDelete() { $content_entity = EntityTest::create(); $content_entity->save(); /** @var \Drupal\Core\Config\Entity\ConfigEntityStorage $storage */ - $storage = $this->container->get('entity.manager')->getStorage('config_test'); + $storage = $this->container->get('entity_type.manager')->getStorage('config_test'); $entity1 = $storage->create( [ 'id' => 'entity1', diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php index fcc472f9e2c9..0f8609cc24b8 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php @@ -39,7 +39,7 @@ class ConfigEntityUnitTest extends KernelTestBase { */ protected function setUp() { parent::setUp(); - $this->storage = $this->container->get('entity.manager')->getStorage('config_test'); + $this->storage = $this->container->get('entity_type.manager')->getStorage('config_test'); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Datetime/DateFormatterTest.php b/core/tests/Drupal/KernelTests/Core/Datetime/DateFormatterTest.php index 06e312383da5..254dc7af44fc 100644 --- a/core/tests/Drupal/KernelTests/Core/Datetime/DateFormatterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Datetime/DateFormatterTest.php @@ -36,7 +36,7 @@ protected function setUp() { 'Long month name' => ['March' => 'marzo'], ]); - $formats = $this->container->get('entity.manager') + $formats = $this->container->get('entity_type.manager') ->getStorage('date_format') ->loadMultiple(['long', 'medium', 'short']); $formats['long']->setPattern('l, j. F Y - G:i')->save(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php index 613ba4e17dd1..3c2e3aee1c54 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php @@ -49,14 +49,14 @@ protected function assertValidation($bundle) { ->addConstraint('Bundle', $bundle); // Test the validation. - $node = $this->container->get('entity.manager')->getStorage('node')->create(['type' => 'foo']); + $node = $this->container->get('entity_type.manager')->getStorage('node')->create(['type' => 'foo']); $typed_data = $this->typedData->create($definition, $node); $violations = $typed_data->validate(); $this->assertEqual($violations->count(), 0, 'Validation passed for correct value.'); // Test the validation when an invalid value is passed. - $page_node = $this->container->get('entity.manager')->getStorage('node')->create(['type' => 'baz']); + $page_node = $this->container->get('entity_type.manager')->getStorage('node')->create(['type' => 'baz']); $typed_data = $this->typedData->create($definition, $page_node); $violations = $typed_data->validate(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php index c3eb8ef583c0..2ce4ef538954 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php @@ -174,7 +174,7 @@ public function testEntityAccessDefaultController() { // Check that the default access control handler is used for entities that don't // have a specific access control handler defined. - $handler = $this->container->get('entity.manager')->getAccessControlHandler('entity_test_default_access'); + $handler = $this->container->get('entity_type.manager')->getAccessControlHandler('entity_test_default_access'); $this->assertTrue($handler instanceof EntityAccessControlHandler, 'The default entity handler is used for the entity_test_default_access entity type.'); $entity = EntityTestDefaultAccess::create(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php index 3671d6d408e8..e9edd672d122 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php @@ -38,7 +38,7 @@ public function testValidation() { ); // Test the validation. - $node = $this->container->get('entity.manager')->getStorage('node')->create(['type' => 'page']); + $node = $this->container->get('entity_type.manager')->getStorage('node')->create(['type' => 'page']); $typed_data = $this->typedData->create($definition, $node); $violations = $typed_data->validate(); $this->assertEqual($violations->count(), 0, 'Validation passed for correct value.'); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php index 68129909f32e..4172772be782 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php @@ -49,12 +49,12 @@ public function testEntityViewBuilderCache() { // Test that new entities (before they are saved for the first time) do not // generate a cache entry. - $build = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'full'); + $build = $this->container->get('entity_type.manager')->getViewBuilder('entity_test')->view($entity_test, 'full'); $this->assertTrue(isset($build['#cache']) && array_keys($build['#cache']) == ['tags', 'contexts', 'max-age'], 'The render array element of new (unsaved) entities is not cached, but does have cache tags set.'); // Get a fully built entity view render array. $entity_test->save(); - $build = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'full'); + $build = $this->container->get('entity_type.manager')->getViewBuilder('entity_test')->view($entity_test, 'full'); $cid_parts = array_merge($build['#cache']['keys'], $cache_contexts_manager->convertTokensToKeys(['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme', 'user.permissions'])->getKeys()); $cid = implode(':', $cid_parts); $bin = $build['#cache']['bin']; @@ -110,7 +110,7 @@ public function testEntityViewBuilderCacheWithReferences() { $entity_test_reference->save(); // Get a fully built entity view render array for the referenced entity. - $build = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test_reference, 'full'); + $build = $this->container->get('entity_type.manager')->getViewBuilder('entity_test')->view($entity_test_reference, 'full'); $cid_parts = array_merge($build['#cache']['keys'], $cache_contexts_manager->convertTokensToKeys(['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme', 'user.permissions'])->getKeys()); $cid_reference = implode(':', $cid_parts); $bin_reference = $build['#cache']['bin']; @@ -129,7 +129,7 @@ public function testEntityViewBuilderCacheWithReferences() { $entity_test->save(); // Get a fully built entity view render array. - $build = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'full'); + $build = $this->container->get('entity_type.manager')->getViewBuilder('entity_test')->view($entity_test, 'full'); $cid_parts = array_merge($build['#cache']['keys'], $cache_contexts_manager->convertTokensToKeys(['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme', 'user.permissions'])->getKeys()); $cid = implode(':', $cid_parts); $bin = $build['#cache']['bin']; @@ -160,18 +160,18 @@ public function testEntityViewBuilderCacheToggling() { // Test a view mode in default conditions: render caching is enabled for // the entity type and the view mode. - $build = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'full'); + $build = $this->container->get('entity_type.manager')->getViewBuilder('entity_test')->view($entity_test, 'full'); $this->assertTrue(isset($build['#cache']) && array_keys($build['#cache']) == ['tags', 'contexts', 'max-age', 'keys', 'bin'], 'A view mode with render cache enabled has the correct output (cache tags, keys, contexts, max-age and bin).'); // Test that a view mode can opt out of render caching. - $build = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'test'); + $build = $this->container->get('entity_type.manager')->getViewBuilder('entity_test')->view($entity_test, 'test'); $this->assertTrue(isset($build['#cache']) && array_keys($build['#cache']) == ['tags', 'contexts', 'max-age'], 'A view mode with render cache disabled has the correct output (only cache tags, contexts and max-age).'); // Test that an entity type can opt out of render caching completely. $this->installEntitySchema('entity_test_label'); $entity_test_no_cache = $this->createTestEntity('entity_test_label'); $entity_test_no_cache->save(); - $build = $this->container->get('entity.manager')->getViewBuilder('entity_test_label')->view($entity_test_no_cache, 'full'); + $build = $this->container->get('entity_type.manager')->getViewBuilder('entity_test_label')->view($entity_test_no_cache, 'full'); $this->assertTrue(isset($build['#cache']) && array_keys($build['#cache']) == ['tags', 'contexts', 'max-age'], 'An entity type can opt out of render caching regardless of view mode configuration, but always has cache tags, contexts and max-age set.'); } @@ -190,7 +190,7 @@ public function testEntityViewBuilderWeight() { // Create and build a test entity. $entity_test = $this->createTestEntity('entity_test'); - $view = $this->container->get('entity.manager')->getViewBuilder('entity_test')->view($entity_test, 'full'); + $view = $this->container->get('entity_type.manager')->getViewBuilder('entity_test')->view($entity_test, 'full'); $renderer->renderRoot($view); // Check that the weight is respected. @@ -211,7 +211,7 @@ protected function createTestEntity($entity_type) { 'bundle' => $entity_type, 'name' => $this->randomMachineName(), ]; - return $this->container->get('entity.manager')->getStorage($entity_type)->create($data); + return $this->container->get('entity_type.manager')->getStorage($entity_type)->create($data); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php index 76e7004d23c0..7e9300c7aaec 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php @@ -104,7 +104,7 @@ protected function setUp() { */ public function testFieldLoad() { $entity_type = $bundle = 'entity_test_rev'; - $storage = $this->container->get('entity.manager')->getStorage($entity_type); + $storage = $this->container->get('entity_type.manager')->getStorage($entity_type); $columns = ['bundle', 'deleted', 'entity_id', 'revision_id', 'delta', 'langcode', $this->tableMapping->getFieldColumnName($this->fieldStorage, 'value')]; @@ -276,7 +276,7 @@ public function testLongNames() { // Use one of the longest entity_type names in core. $entity_type = $bundle = 'entity_test_label_callback'; $this->installEntitySchema('entity_test_label_callback'); - $storage = $this->container->get('entity.manager')->getStorage($entity_type); + $storage = $this->container->get('entity_type.manager')->getStorage($entity_type); // Create two fields and generate random values. $name_base = mb_strtolower($this->randomMachineName(FieldStorageConfig::NAME_MAX_LENGTH - 1)); @@ -440,7 +440,7 @@ public function testFieldUpdateIndexesWithData() { } // Verify that the tables were not dropped in the process. - $entity = $this->container->get('entity.manager')->getStorage($entity_type)->load(1); + $entity = $this->container->get('entity_type.manager')->getStorage($entity_type)->load(1); $this->assertEqual($entity->$field_name->value, 'field data', t("Index changes performed without dropping the tables")); } diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php index 0f1ffc47eec2..3426463b3bad 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php @@ -3,7 +3,6 @@ namespace Drupal\Tests\Core\Config\Entity; use Drupal\Core\DependencyInjection\ContainerBuilder; -use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Tests\UnitTestCase; @@ -27,13 +26,6 @@ class EntityDisplayModeBaseUnitTest extends UnitTestCase { */ protected $entityInfo; - /** - * The entity manager used for testing. - * - * @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $entityManager; - /** * The entity type manager used for testing. * @@ -68,19 +60,12 @@ protected function setUp() { $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class); - $this->entityManager = new EntityManager(); - $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface'); $container = new ContainerBuilder(); - $container->set('entity.manager', $this->entityManager); $container->set('entity_type.manager', $this->entityTypeManager); $container->set('uuid', $this->uuid); - // Inject the container into entity.manager so it can defer to - // entity_type.manager. - $this->entityManager->setContainer($container); - \Drupal::setContainer($container); } diff --git a/core/tests/Drupal/Tests/Core/Entity/Access/EntityFormDisplayAccessControlHandlerTest.php b/core/tests/Drupal/Tests/Core/Entity/Access/EntityFormDisplayAccessControlHandlerTest.php index 01d9ae2560af..2c6e0ff5840a 100644 --- a/core/tests/Drupal/Tests/Core/Entity/Access/EntityFormDisplayAccessControlHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Access/EntityFormDisplayAccessControlHandlerTest.php @@ -10,7 +10,6 @@ use Drupal\Core\Entity\Entity\Access\EntityFormDisplayAccessControlHandler; use Drupal\Core\Entity\Entity\EntityFormDisplay; use Drupal\Core\Entity\EntityFieldManagerInterface; -use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -173,9 +172,7 @@ protected function setUp() { ->method('getFieldDefinitions') ->will($this->returnValue([])); - $entity_manager = new EntityManager(); $container = new Container(); - $container->set('entity.manager', $entity_manager); $container->set('entity_type.manager', $entity_type_manager); $container->set('entity_field.manager', $entity_field_manager); $container->set('language_manager', $this->getMock(LanguageManagerInterface::class)); @@ -185,9 +182,6 @@ protected function setUp() { $container->set('uuid', $this->getMock(UuidInterface::class)); $container->set('renderer', $this->getMock(RendererInterface::class)); $container->set('cache_contexts_manager', $this->prophesize(CacheContextsManager::class)); - // Inject the container into entity.manager so it can defer to - // entity_type.manager. - $entity_manager->setContainer($container); \Drupal::setContainer($container); $this->entity = new EntityFormDisplay([ diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php index 52cdd7621fc4..b2a9922f64e2 100644 --- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php @@ -7,7 +7,6 @@ use Drupal\Core\Entity\ContentEntityBase; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\EntityFieldManagerInterface; -use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Field\BaseFieldDefinition; @@ -52,13 +51,6 @@ class ContentEntityBaseUnitTest extends UnitTestCase { */ protected $entityType; - /** - * The entity manager used for testing. - * - * @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $entityManager; - /** * The entity field manager used for testing. * @@ -150,8 +142,6 @@ protected function setUp() { 'uuid' => 'uuid', ])); - $this->entityManager = new EntityManager(); - $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class); $this->entityTypeManager->expects($this->any()) ->method('getDefinition') @@ -199,7 +189,6 @@ protected function setUp() { ->will($this->returnValue($this->getMock('Drupal\Core\Field\FieldItemListInterface'))); $container = new ContainerBuilder(); - $container->set('entity.manager', $this->entityManager); $container->set('entity_field.manager', $this->entityFieldManager); $container->set('entity_type.bundle.info', $this->entityTypeBundleInfo); $container->set('entity_type.manager', $this->entityTypeManager); @@ -207,9 +196,6 @@ protected function setUp() { $container->set('typed_data_manager', $this->typedDataManager); $container->set('language_manager', $this->languageManager); $container->set('plugin.manager.field.field_type', $this->fieldTypePluginManager); - // Inject the container into entity.manager so it can defer to - // entity_type.manager and other services. - $this->entityManager->setContainer($container); \Drupal::setContainer($container); $this->fieldDefinitions = [ diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php index 87b8a68fc1cc..e5c07af5ac9e 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php @@ -189,7 +189,7 @@ protected function setUpEntityTypeDefinitions($definitions = []) { $class = $this->getMockClass(EntityInterface::class); foreach ($definitions as $key => $entity_type) { // \Drupal\Core\Entity\EntityTypeInterface::getLinkTemplates() is called - // by \Drupal\Core\Entity\EntityManager::processDefinition() so it must + // by \Drupal\Core\Entity\EntityTypeManager::processDefinition() so it must // always be mocked. $entity_type->getLinkTemplates()->willReturn([]); @@ -281,7 +281,7 @@ public function testGetBaseFieldDefinitionsTranslatableEntityTypeDefaultLangcode $field_definition = $this->prophesize()->willImplement(FieldDefinitionInterface::class)->willImplement(FieldStorageDefinitionInterface::class); $field_definition->isTranslatable()->willReturn(TRUE); - $entity_class = EntityManagerTestEntity::class; + $entity_class = EntityTypeManagerTestEntity::class; $entity_class::$baseFieldDefinitions += ['langcode' => $field_definition]; $this->entityType->isTranslatable()->willReturn(TRUE); @@ -323,7 +323,7 @@ public function testGetBaseFieldDefinitionsTranslatableEntityTypeLangcode($provi $field_definition->setTranslatable(!$translatable)->shouldBeCalled(); } - $entity_class = EntityManagerTestEntity::class; + $entity_class = EntityTypeManagerTestEntity::class; $entity_class::$baseFieldDefinitions += ['langcode' => $field_definition->reveal()]; } @@ -515,7 +515,7 @@ protected function setUpEntityWithFieldDefinition($custom_invoke_all = FALSE, $f $string_translation = $this->prophesize(TranslationInterface::class); $this->container->get('string_translation')->willReturn($string_translation->reveal()); - $entity_class = EntityManagerTestEntity::class; + $entity_class = EntityTypeManagerTestEntity::class; $field_definition = $this->prophesize()->willImplement(FieldDefinitionInterface::class)->willImplement(FieldStorageDefinitionInterface::class); $entity_class::$baseFieldDefinitions = [ @@ -613,7 +613,7 @@ public function testGetFieldMap() { // Set up a content entity type. $entity_type = $this->prophesize(ContentEntityTypeInterface::class); - $entity_class = EntityManagerTestEntity::class; + $entity_class = EntityTypeManagerTestEntity::class; // Define an ID field definition as a base field. $id_definition = $this->prophesize(FieldDefinitionInterface::class); @@ -711,7 +711,7 @@ public function testGetFieldMapFromCache() { public function testGetFieldMapByFieldType() { // Set up a content entity type. $entity_type = $this->prophesize(ContentEntityTypeInterface::class); - $entity_class = EntityManagerTestEntity::class; + $entity_class = EntityTypeManagerTestEntity::class; // Set up the entity type bundle info to return two bundles for the // fieldable entity type. @@ -789,7 +789,7 @@ public function testClearEntityFieldInfo() { /** * Provides a content entity with dummy static method implementations. */ -abstract class EntityManagerTestEntity implements \Iterator, ContentEntityInterface { +abstract class EntityTypeManagerTestEntity implements \Iterator, ContentEntityInterface { /** * The base field definitions. diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php index e95b7844fc8c..c12a6b04d7b0 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php @@ -5,16 +5,23 @@ use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\Entity\Display\EntityFormDisplayInterface; use Drupal\Core\Entity\Display\EntityViewDisplayInterface; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityDisplayRepositoryInterface; use Drupal\Core\Entity\EntityFieldManager; +use Drupal\Core\Entity\EntityFormInterface; +use Drupal\Core\Entity\EntityHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface; +use Drupal\Core\Entity\EntityListBuilderInterface; use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityRepositoryInterface; +use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityType; use Drupal\Core\Entity\EntityTypeBundleInfoInterface; +use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeManager; use Drupal\Core\Entity\EntityTypeRepositoryInterface; +use Drupal\Core\Entity\EntityViewBuilderInterface; use Drupal\Tests\UnitTestCase; /** @@ -590,4 +597,133 @@ public function testGetFormDisplay() { $this->assertInstanceOf(EntityFormDisplayInterface::class, $this->entityManager->getFormDisplay('entity_test', 'bundle', 'default')); } + /** + * @covers ::getDefinition + * + * @expectedDeprecation EntityManagerInterface::getDefinition() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getDefinition() instead. See https://www.drupal.org/node/2549139 + */ + public function testGetDefinition() { + $entity_type = $this->prophesize(EntityTypeInterface::class)->reveal(); + $this->entityTypeManager->getDefinition('entity_test', TRUE)->shouldBeCalled()->willReturn($entity_type); + $this->assertInstanceOf(EntityTypeInterface::class, $this->entityManager->getDefinition('entity_test')); + } + + /** + * @covers ::getDefinitions + * + * @expectedDeprecation EntityManagerInterface::getDefinitions() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getDefinitions() instead. See https://www.drupal.org/node/2549139 + */ + public function testGetDefinitions() { + $this->entityTypeManager->getDefinitions()->shouldBeCalled()->willReturn([]); + $this->assertEquals([], $this->entityManager->getDefinitions()); + } + + /** + * @covers ::hasDefinition + * + * @expectedDeprecation EntityManagerInterface::hasDefinition() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::hasDefinition() instead. See https://www.drupal.org/node/2549139 + */ + public function testHasDefinition() { + $this->entityTypeManager->hasDefinition('entity_test')->shouldBeCalled()->willReturn(TRUE); + $this->assertTrue($this->entityManager->hasDefinition('entity_test')); + } + + /** + * @covers ::getDefinitions + * + * @expectedDeprecation EntityManagerInterface::getRouteProviders() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getRouteProviders() instead. See https://www.drupal.org/node/2549139 + */ + public function testGetRouteProviders() { + $this->entityTypeManager->getRouteProviders('entity_test')->shouldBeCalled()->willReturn([]); + $this->assertEquals([], $this->entityManager->getRouteProviders('entity_test')); + } + + /** + * @covers ::hasHandler + * + * @expectedDeprecation EntityManagerInterface::hasHandler() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::hasHandler() instead. See https://www.drupal.org/node/2549139 + */ + public function testHasHandler() { + $this->entityTypeManager->hasHandler('entity_test', 'storage')->shouldBeCalled()->willReturn(TRUE); + $this->assertTrue($this->entityManager->hasHandler('entity_test', 'storage')); + } + + /** + * @covers ::getStorage + * + * @expectedDeprecation EntityManagerInterface::getStorage() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getStorage() instead. See https://www.drupal.org/node/2549139 + */ + public function testGetStorage() { + $storage = $this->prophesize(EntityStorageInterface::class)->reveal(); + $this->entityTypeManager->getStorage('entity_test')->shouldBeCalled()->willReturn($storage); + $this->assertInstanceOf(EntityStorageInterface::class, $this->entityManager->getStorage('entity_test')); + } + + /** + * @covers ::getFormObject + * + * @expectedDeprecation EntityManagerInterface::getFormObject() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getFormObject() instead. See https://www.drupal.org/node/2549139 + */ + public function testGetFormObject() { + $form_object = $this->prophesize(EntityFormInterface::class)->reveal(); + $this->entityTypeManager->getFormObject('entity_test', 'edit')->shouldBeCalled()->willReturn($form_object); + $this->assertInstanceOf(EntityFormInterface::class, $this->entityManager->getFormObject('entity_test', 'edit')); + } + + /** + * @covers ::getListBuilder + * + * @expectedDeprecation EntityManagerInterface::getListBuilder() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getListBuilder() instead. See https://www.drupal.org/node/2549139 + */ + public function testGetListBuilder() { + $list_builder = $this->prophesize(EntityListBuilderInterface::class)->reveal(); + $this->entityTypeManager->getListBuilder('entity_test')->shouldBeCalled()->willReturn($list_builder); + $this->assertInstanceOf(EntityListBuilderInterface::class, $this->entityManager->getListBuilder('entity_test')); + } + + /** + * @covers ::getViewBuilder + * + * @expectedDeprecation EntityManagerInterface::getViewBuilder() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getViewBuilder() instead. See https://www.drupal.org/node/2549139 + */ + public function testGetViewBuilder() { + $view_builder = $this->prophesize(EntityViewBuilderInterface::class)->reveal(); + $this->entityTypeManager->getViewBuilder('entity_test')->shouldBeCalled()->willReturn($view_builder); + $this->assertInstanceOf(EntityViewBuilderInterface::class, $this->entityManager->getViewBuilder('entity_test')); + } + + /** + * @covers ::getAccessControlHandler + * + * @expectedDeprecation EntityManagerInterface::getAccessControlHandler() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getAccessControlHandler() instead. See https://www.drupal.org/node/2549139 + */ + public function testGetAccessControlHandler() { + $access_control_handler = $this->prophesize(EntityAccessControlHandlerInterface::class)->reveal(); + $this->entityTypeManager->getAccessControlHandler('entity_test')->shouldBeCalled()->willReturn($access_control_handler); + $this->assertInstanceOf(EntityAccessControlHandlerInterface::class, $this->entityManager->getAccessControlHandler('entity_test')); + } + + /** + * @covers ::getHandler + * + * @expectedDeprecation EntityManagerInterface::getHandler() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getHandler() instead. See https://www.drupal.org/node/2549139 + */ + public function testGetHandler() { + $handler = $this->prophesize(EntityHandlerInterface::class)->reveal(); + $this->entityTypeManager->getHandler('entity_test', 'storage')->shouldBeCalled()->willReturn($handler); + $this->assertInstanceOf(EntityHandlerInterface::class, $this->entityManager->getHandler('entity_test', 'storage')); + } + + /** + * @covers ::createHandlerInstance + * + * @expectedDeprecation EntityManagerInterface::createHandlerInstance() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::createHandlerInstance() instead. See https://www.drupal.org/node/2549139 + */ + public function testCreateHandlerInstance() { + $handler = $this->prophesize(EntityHandlerInterface::class)->reveal(); + $entity_type = $this->prophesize(EntityTypeInterface::class)->reveal(); + $this->entityTypeManager->createHandlerInstance(EntityHandlerInterface::class, $entity_type)->shouldBeCalled()->willReturn($handler); + $this->assertInstanceOf(EntityHandlerInterface::class, $this->entityManager->createHandlerInstance(EntityHandlerInterface::class, $entity_type)); + } + } diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php index d4e0442010f7..4eb2d13a0935 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php @@ -116,7 +116,7 @@ protected function setUpEntityTypeDefinitions($definitions = []) { $class = $this->getMockClass(EntityInterface::class); foreach ($definitions as $key => $entity_type) { // \Drupal\Core\Entity\EntityTypeInterface::getLinkTemplates() is called - // by \Drupal\Core\Entity\EntityManager::processDefinition() so it must + // by \Drupal\Core\Entity\EntitTypeManager::processDefinition() so it must // always be mocked. $entity_type->getLinkTemplates()->willReturn([]); diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php index 915ecd681817..b9554e337099 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php @@ -53,7 +53,7 @@ protected function setUpEntityTypeDefinitions($definitions = []) { $class = $this->getMockClass(EntityInterface::class); foreach ($definitions as $key => $entity_type) { // \Drupal\Core\Entity\EntityTypeInterface::getLinkTemplates() is called - // by \Drupal\Core\Entity\EntityManager::processDefinition() so it must + // by \Drupal\Core\Entity\EntityTypeManager::processDefinition() so it must // always be mocked. $entity_type->getLinkTemplates()->willReturn([]); diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php index 7027d7f707c2..262e8991e9a9 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php @@ -576,12 +576,12 @@ public function testUriRelationships() { * An array of entity values to construct the mock entity with. * @param array $methods * (optional) An array of additional methods to mock on the entity object. - * The getEntityType() and entityManager() methods are always mocked. + * The getEntityType() and entityTypeBundleInfo() methods are always mocked. * * @return \Drupal\Core\Entity\Entity|\PHPUnit_Framework_MockObject_MockObject */ protected function getEntity($class, array $values, array $methods = []) { - $methods = array_merge($methods, ['getEntityType', 'entityManager', 'entityTypeBundleInfo']); + $methods = array_merge($methods, ['getEntityType', 'entityTypeBundleInfo']); // Prophecy does not allow prophesizing abstract classes while actually // calling their code. We use Prophecy below because that allows us to diff --git a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php index 0715ca780614..f152149ab079 100644 --- a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php @@ -8,7 +8,6 @@ use Drupal\Core\Entity\EntityFieldManagerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityMalformedException; -use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityStorageException; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Language\Language; @@ -61,13 +60,6 @@ class KeyValueEntityStorageTest extends UnitTestCase { */ protected $entityStorage; - /** - * The entity manager. - * - * @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $entityManager; - /** * The mocked entity type manager. * @@ -120,8 +112,6 @@ protected function setUpKeyValueEntityStorage($uuid_key = 'uuid') { ->method('getListCacheTags') ->willReturn(['test_entity_type_list']); - $this->entityManager = new EntityManager(); - $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class); $this->entityTypeManager->expects($this->any()) ->method('getDefinition') @@ -148,14 +138,10 @@ protected function setUpKeyValueEntityStorage($uuid_key = 'uuid') { $this->entityStorage->setModuleHandler($this->moduleHandler); $container = new ContainerBuilder(); - $container->set('entity.manager', $this->entityManager); $container->set('entity_field.manager', $this->entityFieldManager); $container->set('entity_type.manager', $this->entityTypeManager); $container->set('language_manager', $this->languageManager); $container->set('cache_tags.invalidator', $this->cacheTagsInvalidator); - // Inject the container into entity.manager so it can defer to - // entity_type.manager and other services. - $this->entityManager->setContainer($container); \Drupal::setContainer($container); } diff --git a/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php index 2881f39a5a90..cd28156ad372 100644 --- a/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php @@ -4,7 +4,6 @@ use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\Entity\EntityFieldManagerInterface; -use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\Plugin\DataType\EntityAdapter; use Drupal\Core\Field\BaseFieldDefinition; @@ -49,13 +48,6 @@ class EntityAdapterUnitTest extends UnitTestCase { */ protected $entityType; - /** - * The entity manager used for testing. - * - * @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $entityManager; - /** * The entity type manager used for testing. * @@ -146,8 +138,6 @@ protected function setUp() { 'uuid' => 'uuid', ])); - $this->entityManager = new EntityManager(); - $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class); $this->entityTypeManager->expects($this->any()) ->method('getDefinition') @@ -204,16 +194,12 @@ protected function setUp() { $this->entityFieldManager = $this->getMockForAbstractClass(EntityFieldManagerInterface::class); $container = new ContainerBuilder(); - $container->set('entity.manager', $this->entityManager); $container->set('entity_type.manager', $this->entityTypeManager); $container->set('entity_field.manager', $this->entityFieldManager); $container->set('uuid', $this->uuid); $container->set('typed_data_manager', $this->typedDataManager); $container->set('language_manager', $this->languageManager); $container->set('plugin.manager.field.field_type', $this->fieldTypePluginManager); - // Inject the container into entity.manager so it can defer to - // entity_type.manager and other services. - $this->entityManager->setContainer($container); \Drupal::setContainer($container); $this->fieldDefinitions = [ diff --git a/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php b/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php index 1312f40c80ce..2177cd860af7 100644 --- a/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php +++ b/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php @@ -72,16 +72,16 @@ protected function setUp() { } /** - * Sets up the entity manager to be tested. + * Sets up the entity type manager to be tested. * * @param \Drupal\Core\Entity\EntityTypeInterface[]|\Prophecy\Prophecy\ProphecyInterface[] $definitions * (optional) An array of entity type definitions. */ - protected function setUpEntityManager($definitions = []) { + protected function setUpEntityTypeManager($definitions = []) { $class = $this->getMockClass(EntityInterface::class); foreach ($definitions as $key => $entity_type) { // \Drupal\Core\Entity\EntityTypeInterface::getLinkTemplates() is called - // by \Drupal\Core\Entity\EntityManager::processDefinition() so it must + // by \Drupal\Core\Entity\EntityTypeManager::processDefinition() so it must // always be mocked. $entity_type->getLinkTemplates()->willReturn([]); @@ -123,7 +123,7 @@ public function testOnFieldDefinitionCreateNewField() { $this->entityTypeManager->getStorage('test_entity_type')->willReturn($storage->reveal()); $entity = $this->prophesize(EntityTypeInterface::class); - $this->setUpEntityManager(['test_entity_type' => $entity]); + $this->setUpEntityTypeManager(['test_entity_type' => $entity]); // Set up the stored bundle field map. $key_value_store = $this->prophesize(KeyValueStoreInterface::class); @@ -153,7 +153,7 @@ public function testOnFieldDefinitionCreateExistingField() { $this->entityTypeManager->getStorage('test_entity_type')->willReturn($storage->reveal()); $entity = $this->prophesize(EntityTypeInterface::class); - $this->setUpEntityManager(['test_entity_type' => $entity]); + $this->setUpEntityTypeManager(['test_entity_type' => $entity]); // Set up the stored bundle field map. $key_value_store = $this->prophesize(KeyValueStoreInterface::class); @@ -187,7 +187,7 @@ public function testOnFieldDefinitionUpdate() { $this->entityTypeManager->getStorage('test_entity_type')->willReturn($storage->reveal()); $entity = $this->prophesize(EntityTypeInterface::class); - $this->setUpEntityManager(['test_entity_type' => $entity]); + $this->setUpEntityTypeManager(['test_entity_type' => $entity]); $this->fieldDefinitionListener->onFieldDefinitionUpdate($field_definition->reveal(), $field_definition->reveal()); } @@ -206,7 +206,7 @@ public function testOnFieldDefinitionDeleteMultipleBundles() { $this->entityTypeManager->getStorage('test_entity_type')->willReturn($storage->reveal()); $entity = $this->prophesize(EntityTypeInterface::class); - $this->setUpEntityManager(['test_entity_type' => $entity]); + $this->setUpEntityTypeManager(['test_entity_type' => $entity]); // Set up the stored bundle field map. $key_value_store = $this->prophesize(KeyValueStoreInterface::class); @@ -246,7 +246,7 @@ public function testOnFieldDefinitionDeleteSingleBundles() { $this->entityTypeManager->getStorage('test_entity_type')->willReturn($storage->reveal()); $entity = $this->prophesize(EntityTypeInterface::class); - $this->setUpEntityManager(['test_entity_type' => $entity]); + $this->setUpEntityTypeManager(['test_entity_type' => $entity]); // Set up the stored bundle field map. $key_value_store = $this->prophesize(KeyValueStoreInterface::class); diff --git a/core/tests/Drupal/Tests/EntityViewTrait.php b/core/tests/Drupal/Tests/EntityViewTrait.php index bd75541d20de..155d2b6fb2ec 100644 --- a/core/tests/Drupal/Tests/EntityViewTrait.php +++ b/core/tests/Drupal/Tests/EntityViewTrait.php @@ -58,7 +58,7 @@ protected function buildEntityView(EntityInterface $entity, $view_mode = 'full', } }; - $render_controller = $this->container->get('entity.manager')->getViewBuilder($entity->getEntityTypeId()); + $render_controller = $this->container->get('entity_type.manager')->getViewBuilder($entity->getEntityTypeId()); if ($reset) { $render_controller->resetCache([$entity->id()]); } -- GitLab