From 408c540ccf24e71daf6ea02a878b5869abc2f926 Mon Sep 17 00:00:00 2001 From: Alex Pott 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 4fe6bc757cd..f82a9ab802c 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 @@ class EmailAction extends ConfigurableActionBase implements ContainerFactoryPlug 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 315a98cbfe3..274c47ad960 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 e5d94a9ebc6..26e6782f081 100644 --- a/core/lib/Drupal/Core/Entity/Entity/EntityFormMode.php +++ b/core/lib/Drupal/Core/Entity/Entity/EntityFormMode.php @@ -19,8 +19,8 @@ use Drupal\Core\Entity\EntityFormModeInterface; * 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 6872a1bd1e9..f8b0b6ab2a9 100644 --- a/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManagerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManagerInterface.php @@ -13,10 +13,11 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; * 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 6e9564caea2..cdb70747ef5 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 13f8ccc407a..14de96e7358 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -13,9 +13,6 @@ use Symfony\Component\DependencyInjection\ContainerAwareTrait; * 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 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface { * @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 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface { * @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 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface { * @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 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface { * @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 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface { * @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 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface { * @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 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface { * @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 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface { * @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 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface { * @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 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface { * @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 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface { * @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 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface { * @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 b6f688a0fcb..b24ce9b9c3b 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 d21a2a89ef8..dc2a6ea1a7f 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 @@ interface FieldableEntityInterface extends EntityInterface { * @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 @@ interface FieldableEntityInterface extends EntityInterface { * @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 7d9711e4c00..9cb8642b7d1 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 1415a1aba66..1f7fd6d07e9 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 74ddd1b4d70..824c894657e 100644 --- a/core/lib/Drupal/Core/Entity/entity.api.php +++ b/core/lib/Drupal/Core/Entity/entity.api.php @@ -582,7 +582,7 @@ use Drupal\node\Entity\NodeType; * @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 022212e8237..94f2d2c7fc3 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 661883d851e..111a27a6468 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 f73f08340ab..cbc6d7ddd55 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 @@ class TimestampFormatter extends FormatterBase implements ContainerFactoryPlugin $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 09d866f2882..70e257642c9 100644 --- a/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php +++ b/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php @@ -93,7 +93,7 @@ class SiteConfigureForm extends ConfigFormBase { 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 237972ce7e4..b73ca4c41e0 100644 --- a/core/modules/action/src/Form/ActionFormBase.php +++ b/core/modules/action/src/Form/ActionFormBase.php @@ -42,7 +42,7 @@ abstract class ActionFormBase extends EntityForm { */ 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 28eda681876..6bb753e5e7a 100644 --- a/core/modules/action/tests/src/Functional/ActionListTest.php +++ b/core/modules/action/tests/src/Functional/ActionListTest.php @@ -27,7 +27,7 @@ class ActionListTest extends BrowserTestBase { // 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 7958f5f7ba9..53573500d7f 100644 --- a/core/modules/aggregator/src/Form/OpmlFeedAdd.php +++ b/core/modules/aggregator/src/Form/OpmlFeedAdd.php @@ -49,7 +49,7 @@ class OpmlFeedAdd extends FormBase { */ 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 4a51897b221..9873fe4253d 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 @@ class Iid extends NumericArgument { * {@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 4b278d62471..b3f904c12d8 100644 --- a/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php +++ b/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php @@ -69,7 +69,7 @@ class AggregatorAdminTest extends AggregatorTestBase { // 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 @@ class AggregatorAdminTest extends AggregatorTestBase { // 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 7c7a1fb0506..a5703402ed1 100644 --- a/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php +++ b/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php @@ -55,7 +55,7 @@ class AggregatorRenderingTest extends AggregatorTestBase { $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 7f6a4087f75..67fe2767f09 100644 --- a/core/modules/aggregator/tests/src/Functional/DeleteFeedTest.php +++ b/core/modules/aggregator/tests/src/Functional/DeleteFeedTest.php @@ -34,7 +34,7 @@ class DeleteFeedTest extends AggregatorTestBase { // 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 39f57b25188..8094effc798 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 @@ class IntegrationTest extends ViewsKernelTestBase { 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 5dc017fde1f..5624fc577ef 100644 --- a/core/modules/block/src/BlockForm.php +++ b/core/modules/block/src/BlockForm.php @@ -110,7 +110,7 @@ class BlockForm extends EntityForm { */ 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 e95ccd2c7b4..d64c0bddc8a 100644 --- a/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php +++ b/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php @@ -98,8 +98,8 @@ class BlockPageVariant extends VariantBase implements PageVariantInterface, Cont $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 08525674e34..b14ca5506ce 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 @@ class BlockPluginId extends ProcessPluginBase implements ContainerFactoryPluginI * {@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 @@ class BlockPluginId extends ProcessPluginBase implements ContainerFactoryPluginI $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 f19f9211678..664ea2e37bf 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 @@ class BlockFormTest extends UnitTestCase { $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 @@ class BlockFormTest extends UnitTestCase { ->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 08408a16b00..5ea0935996e 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 ba1ab989688..caffc8d9bf0 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 @@ class BlockContent extends DeriverBase implements ContainerDeriverInterface { * {@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 ea5dd2873de..03e0ea3daef 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 @@ class BlockContentCacheTagsTest extends EntityCacheTagsTestBase { */ 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 8919c05d001..556dda69c88 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 @@ class BlockContentListTest extends BlockContentTestBase { // 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 f9cf29eb77b..186b32d4088 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 @@ class BlockContentListViewsTest extends BlockContentTestBase { // 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 6428aed6e48..d1e662008d8 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 @@ class BlockContentTypeTest extends BlockContentTestBase { // 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 8ec9d64a167..d5d29c1cc82 100644 --- a/core/modules/book/src/Form/BookAdminEditForm.php +++ b/core/modules/book/src/Form/BookAdminEditForm.php @@ -51,9 +51,9 @@ class BookAdminEditForm extends FormBase { * {@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 e55fe365256..d48568fe361 100644 --- a/core/modules/book/src/Plugin/Block/BookNavigationBlock.php +++ b/core/modules/book/src/Plugin/Block/BookNavigationBlock.php @@ -78,7 +78,7 @@ class BookNavigationBlock extends BlockBase implements ContainerFactoryPluginInt $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 9ab4fe2904f..36a6f79a5ca 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 @@ class TopLevelBook extends Node { $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 92dfa00425a..38fdf54ac5b 100644 --- a/core/modules/book/tests/src/Functional/BookTest.php +++ b/core/modules/book/tests/src/Functional/BookTest.php @@ -340,7 +340,7 @@ class BookTest extends BrowserTestBase { * 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 61e665e71c7..564929fafcb 100644 --- a/core/modules/book/tests/src/Unit/BookManagerTest.php +++ b/core/modules/book/tests/src/Unit/BookManagerTest.php @@ -13,11 +13,11 @@ use Drupal\Tests\UnitTestCase; 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 94f0867f245..ba86df205ba 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 @@ class Color extends VariableMultiRow { $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 fe2f7ed5b0d..f02aa338665 100644 --- a/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php +++ b/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php @@ -65,7 +65,7 @@ class UnpublishByKeywordComment extends ConfigurableActionBase implements Contai $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 e946bfb9f8a..f5c6ce7b3f0 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 @@ class UnapprovedComments extends LocalTaskDefault implements ContainerFactoryPlu $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 ebc1a9d03f5..70d756f22d2 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 @@ class CommentNameConstraintValidator extends ConstraintValidator implements Cont * {@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 4a0eae08790..57b7ce24011 100644 --- a/core/modules/comment/tests/src/Functional/CommentStatisticsTest.php +++ b/core/modules/comment/tests/src/Functional/CommentStatisticsTest.php @@ -39,7 +39,7 @@ class CommentStatisticsTest extends CommentTestBase { * 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 516750382ca..e9c3f57a165 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 @@ abstract class CommentViewsKernelTestBase extends ViewsKernelTestBase { $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 f8569d0d794..ea8f0d63433 100644 --- a/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php +++ b/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php @@ -33,7 +33,7 @@ class ConfigDependencyWebTest extends BrowserTestBase { $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 a4dc92c78aa..fde14c7cfba 100644 --- a/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php @@ -26,7 +26,7 @@ class ConfigEntityFormOverrideTest extends BrowserTestBase { $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 16fcc89dd64..8018f136e4b 100644 --- a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php @@ -121,7 +121,7 @@ class ConfigEntityListTest extends BrowserTestBase { // 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 e4aae1a6bce..ec90074d710 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 @@ class ConfigTranslationOverviewTest extends BrowserTestBase { $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 5a4f9d9a42e..918ab1c1966 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 @@ class ConfigEntityMapperTest extends UnitTestCase { $this->getMock('Drupal\config_translation\ConfigMapperManagerInterface'), $this->routeProvider, $this->getStringTranslationStub(), - $this->entityManager, + $this->entityTypeManager, $this->languageManager, $this->eventDispatcher ); @@ -118,7 +118,7 @@ class ConfigEntityMapperTest extends UnitTestCase { ->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 @@ class ConfigEntityMapperTest extends UnitTestCase { */ 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 @@ class ConfigEntityMapperTest extends UnitTestCase { $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 @@ class ConfigEntityMapperTest extends UnitTestCase { $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 3d17e4641e2..86e5216d9a0 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 @@ class ConfigFieldMapperTest extends UnitTestCase { $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 @@ class ConfigFieldMapperTest extends UnitTestCase { ->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 f3025e7b1ce..4299e5e4a0e 100644 --- a/core/modules/contact/tests/src/Kernel/MessageEntityTest.php +++ b/core/modules/contact/tests/src/Kernel/MessageEntityTest.php @@ -34,7 +34,7 @@ class MessageEntityTest extends EntityKernelTestBase { * 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 a47f2247fcc..b2dcb6394e2 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 d7f18c4c766..479c4af9cbf 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php @@ -228,7 +228,7 @@ abstract class ContentTranslationTestBase extends WebTestBase { 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 9d72977899f..5d0f179b67d 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 @@ class ContentTranslationSettingsTest extends BrowserTestBase { $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 7451e17dbad..65bb9aef3dd 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 @@ abstract class ContentTranslationTestBase extends BrowserTestBase { 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 54f1bd14f09..3df89e96fef 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 @@ class ContentTranslationUpdateTest extends UpdatePathTestBase { $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 6cbfe597acf..7e0d99faa95 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 @@ class ContentTranslationConfigImportTest extends KernelTestBase { $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 a6680f6b4d3..a4fe711b8a3 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 @@ abstract class DateTimeFormatterBase extends FormatterBase implements ContainerF $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 2a4ffcd2975..4b4e95a1110 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 @@ class DateTimeDefaultWidget extends DateTimeWidgetBase implements ContainerFacto $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 b31055e39f0..c125e499a54 100644 --- a/core/modules/editor/src/Form/EditorImageDialog.php +++ b/core/modules/editor/src/Form/EditorImageDialog.php @@ -43,7 +43,7 @@ class EditorImageDialog extends FormBase { */ 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 e40e349a742..45ebe378824 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 @@ class EditorConfigEntityUnitTest extends UnitTestCase { ->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 d9f545b68cd..f8a7f4a9cd2 100644 --- a/core/modules/field/src/FieldConfigStorage.php +++ b/core/modules/field/src/FieldConfigStorage.php @@ -83,7 +83,7 @@ class FieldConfigStorage extends FieldConfigStorageBase { $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 dab6c6990b3..5dbbef0a3d0 100644 --- a/core/modules/field/src/FieldStorageConfigStorage.php +++ b/core/modules/field/src/FieldStorageConfigStorage.php @@ -94,7 +94,7 @@ class FieldStorageConfigStorage extends ConfigEntityStorage { $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 5522e0205f9..91da759d676 100644 --- a/core/modules/field/tests/src/Functional/FormTest.php +++ b/core/modules/field/tests/src/Functional/FormTest.php @@ -150,7 +150,7 @@ class FormTest extends FieldTestBase { ]; $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 @@ class FormTest extends FieldTestBase { ]; $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 a8b087461d8..2c444e6a49c 100644 --- a/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php +++ b/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php @@ -203,7 +203,7 @@ class FieldAttachOtherTest extends FieldKernelTestBase { $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 7aa6359c7f7..cc08edb348b 100644 --- a/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php +++ b/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php @@ -46,7 +46,7 @@ class FieldAttachStorageTest extends FieldKernelTestBase { $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 @@ class FieldAttachStorageTest extends FieldKernelTestBase { $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 @@ class FieldAttachStorageTest extends FieldKernelTestBase { 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 14eebec8f8d..33c94e29d03 100644 --- a/core/modules/field/tests/src/Kernel/FieldCrudTest.php +++ b/core/modules/field/tests/src/Kernel/FieldCrudTest.php @@ -337,7 +337,7 @@ class FieldCrudTest extends FieldKernelTestBase { $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 3224763293f..86cb4150e49 100644 --- a/core/modules/field/tests/src/Kernel/FieldDataCountTest.php +++ b/core/modules/field/tests/src/Kernel/FieldDataCountTest.php @@ -136,7 +136,7 @@ class FieldDataCountTest extends FieldKernelTestBase { $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 92dd7d7a31d..568f62cda3d 100644 --- a/core/modules/field/tests/src/Kernel/FieldKernelTestBase.php +++ b/core/modules/field/tests/src/Kernel/FieldKernelTestBase.php @@ -129,7 +129,7 @@ abstract class FieldKernelTestBase extends KernelTestBase { */ 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 10c0a7d9f5a..6d41f2d03e0 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\Entity\EntityType; 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 @@ class FieldConfigEntityUnitTest extends UnitTestCase { $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 @@ class FieldConfigEntityUnitTest extends UnitTestCase { $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 83abd3cad61..9c6a8408fbc 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\Component\Uuid\UuidInterface; 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 @@ class FieldStorageConfigAccessControlHandlerTest extends UnitTestCase { ['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 970532a3e80..bed4eb9bc07 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 ccb968a542b..404e6ed33e8 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 @@ class ManageDisplayTest extends WebDriverTestBase { $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 9bc7dc9949a..484bf2fa022 100644 --- a/core/modules/file/src/Tests/FileFieldTestBase.php +++ b/core/modules/file/src/Tests/FileFieldTestBase.php @@ -197,7 +197,7 @@ abstract class FileFieldTestBase extends WebTestBase { '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 @@ abstract class FileFieldTestBase extends WebTestBase { * 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 @@ abstract class FileFieldTestBase extends WebTestBase { * 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 68fe7d263b7..15130fdae53 100644 --- a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php @@ -65,7 +65,7 @@ class FileFieldDisplayTest extends FileFieldTestBase { $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 f664fb7b6c1..1a909f308ff 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 26d14dbfb49..57d2fd2363a 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 332afc9ea7e..37e2ff5b96e 100644 --- a/core/modules/file/tests/src/Functional/FileFieldRevisionTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldRevisionTest.php @@ -29,7 +29,7 @@ class FileFieldRevisionTest extends FileFieldTestBase { $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 6ae309400ee..cfee3bd697d 100644 --- a/core/modules/file/tests/src/Functional/FileFieldTestBase.php +++ b/core/modules/file/tests/src/Functional/FileFieldTestBase.php @@ -126,7 +126,7 @@ abstract class FileFieldTestBase extends BrowserTestBase { '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 @@ abstract class FileFieldTestBase extends BrowserTestBase { * 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 @@ abstract class FileFieldTestBase extends BrowserTestBase { * 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 c307ce0fb2b..21f2a8ba89c 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 @@ class FileFieldValidateTest extends FileFieldTestBase { * 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 @@ class FileFieldValidateTest extends FileFieldTestBase { * 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 @@ class FileFieldValidateTest extends FileFieldTestBase { * 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 9d20859c0b3..f072f8d5a52 100644 --- a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php @@ -113,7 +113,7 @@ class FileFieldWidgetTest extends FileFieldTestBase { * 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 @@ class FileFieldWidgetTest extends FileFieldTestBase { * 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 7a6824b1323..4b699ef4369 100644 --- a/core/modules/file/tests/src/Functional/FilePrivateTest.php +++ b/core/modules/file/tests/src/Functional/FilePrivateTest.php @@ -37,7 +37,7 @@ class FilePrivateTest extends FileFieldTestBase { * 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 @@ class FilePrivateTest extends FileFieldTestBase { $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 689b1206b43..3f8ad074271 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 338d757c6eb..0d9981ab1e4 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 @@ class MigrateUploadTest extends MigrateDrupal6TestBase { * 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 fd5c90cac5e..634f4e57aaf 100644 --- a/core/modules/file/tests/src/Kernel/SpaceUsedTest.php +++ b/core/modules/file/tests/src/Kernel/SpaceUsedTest.php @@ -55,7 +55,7 @@ class SpaceUsedTest extends FileManagedUnitTestBase { * 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 ea9b0aeeb99..b7e33d68ab1 100644 --- a/core/modules/filter/src/FilterPermissions.php +++ b/core/modules/filter/src/FilterPermissions.php @@ -42,7 +42,7 @@ class FilterPermissions implements ContainerInjectionInterface { * {@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 992500e1f9d..838bee047ca 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 @@ class ForumIntegrationTest extends ViewTestBase { */ 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 c166bb8fb03..f33c20b8700 100644 --- a/core/modules/image/src/Form/ImageStyleEditForm.php +++ b/core/modules/image/src/Form/ImageStyleEditForm.php @@ -42,7 +42,7 @@ class ImageStyleEditForm extends ImageStyleFormBase { */ 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 e446f69afef..166faa8f64b 100644 --- a/core/modules/image/src/Form/ImageStyleFormBase.php +++ b/core/modules/image/src/Form/ImageStyleFormBase.php @@ -41,7 +41,7 @@ abstract class ImageStyleFormBase extends EntityForm { */ 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 b48f0d14aa5..ee99b0f87b5 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 @@ class ImageFormatter extends ImageFormatterBase implements ContainerFactoryPlugi $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 37fa04c7937..7be3c6fc680 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 f0f5ed52e48..6c3d80d2ecb 100644 --- a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php +++ b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php @@ -54,7 +54,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase { 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 @@ class ImageFieldDisplayTest extends ImageFieldTestBase { 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 @@ class ImageFieldDisplayTest extends ImageFieldTestBase { /** @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 74fa6431b5d..a37fa323585 100644 --- a/core/modules/image/tests/src/Kernel/ImageStyleIntegrationTest.php +++ b/core/modules/image/tests/src/Kernel/ImageStyleIntegrationTest.php @@ -88,7 +88,7 @@ class ImageStyleIntegrationTest extends KernelTestBase { // 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 bc954b3cc46..14fd135f113 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 @@ class ImageStyleTest extends UnitTestCase { $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 0b22bc70a49..0679a563d21 100644 --- a/core/modules/language/src/Form/NegotiationConfigureForm.php +++ b/core/modules/language/src/Form/NegotiationConfigureForm.php @@ -93,8 +93,8 @@ class NegotiationConfigureForm extends ConfigFormBase { * {@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 e99a4013584..d028444797e 100644 --- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php +++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php @@ -90,7 +90,7 @@ class LanguageNegotiationContentEntity extends LanguageNegotiationMethodBase imp * {@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 88abdd9006d..06047dfaf02 100644 --- a/core/modules/language/tests/src/Kernel/EntityDefaultLanguageTest.php +++ b/core/modules/language/tests/src/Kernel/EntityDefaultLanguageTest.php @@ -29,7 +29,7 @@ class EntityDefaultLanguageTest extends KernelTestBase { $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 @@ class EntityDefaultLanguageTest extends KernelTestBase { * 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 @@ class EntityDefaultLanguageTest extends KernelTestBase { 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 c3955df56a9..b366406d7ce 100644 --- a/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php +++ b/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php @@ -4,7 +4,6 @@ namespace Drupal\Tests\language\Unit; 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 @@ class ContentLanguageSettingsUnitTest extends UnitTestCase { $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 @@ class ContentLanguageSettingsUnitTest extends UnitTestCase { $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 f36b8fbc94b..5281d08d7a6 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 5035e749038..14a758a216c 100644 --- a/core/modules/link/tests/src/Functional/LinkFieldTest.php +++ b/core/modules/link/tests/src/Functional/LinkFieldTest.php @@ -668,7 +668,7 @@ class LinkFieldTest extends BrowserTestBase { ], ])->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 @@ class LinkFieldTest extends BrowserTestBase { */ 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 8291d2fcfd0..89f7125ec8b 100644 --- a/core/modules/media/tests/src/Functional/MediaRevisionTest.php +++ b/core/modules/media/tests/src/Functional/MediaRevisionTest.php @@ -22,7 +22,7 @@ class MediaRevisionTest extends MediaFunctionalTestBase { $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 0babe2fc743..862882d232d 100644 --- a/core/modules/migrate/src/Plugin/Derivative/MigrateEntity.php +++ b/core/modules/migrate/src/Plugin/Derivative/MigrateEntity.php @@ -36,7 +36,7 @@ class MigrateEntity implements ContainerDeriverInterface { */ 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 cee3b3985ed..99bb6530bf7 100644 --- a/core/modules/migrate/src/Plugin/Derivative/MigrateEntityRevision.php +++ b/core/modules/migrate/src/Plugin/Derivative/MigrateEntityRevision.php @@ -36,7 +36,7 @@ class MigrateEntityRevision implements ContainerDeriverInterface { */ 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 a3b173f8d0c..7e6f9ebf9ae 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 @@ abstract class Entity extends DestinationBase implements ContainerFactoryPluginI $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 868ad1a83f9..5ae0904cd11 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 @@ class EntityConfigBase extends Entity { $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 2d33e3abe32..82399c0a683 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 @@ class MenuLinkParent extends ProcessPluginBase implements ContainerFactoryPlugin $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 13ec353ee55..6ac145e6107 100644 --- a/core/modules/migrate/tests/src/Kernel/MigrateEntityContentBaseTest.php +++ b/core/modules/migrate/tests/src/Kernel/MigrateEntityContentBaseTest.php @@ -55,7 +55,7 @@ class MigrateEntityContentBaseTest extends KernelTestBase { 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 d9728f587e0..ea45a78fca7 100644 --- a/core/modules/migrate/tests/src/Kernel/MigrateExternalTranslatedTest.php +++ b/core/modules/migrate/tests/src/Kernel/MigrateExternalTranslatedTest.php @@ -48,7 +48,7 @@ class MigrateExternalTranslatedTest extends MigrateTestBase { */ 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 f6ed26666f8..219a13f17f1 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 @@ class EntityRevisionTest extends UnitTestCase { $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 @@ class EntityRevisionTest extends UnitTestCase { $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 3e51f459979..cdc63decde6 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 @@ class EntityFieldStorageConfig extends BaseEntityFieldStorageConfig { $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 1e402f3dcec..38b4cbe3abc 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 @@ abstract class DrupalSqlBase extends SqlBase implements ContainerFactoryPluginIn $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 a4a3a9f085c..8433ec7131d 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 fdaf4b10af7..c4df5ba71cc 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 @@ class DrupalSqlBaseTest extends MigrateTestCase { $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 @@ class DrupalSqlBaseTest extends MigrateTestCase { $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 e8866d6f104..5469ae18150 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 @@ class Drupal6SqlBaseTest extends MigrateTestCase { $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 d73dfd5c0fb..aefefde6cd2 100644 --- a/core/modules/node/src/Form/NodeRevisionDeleteForm.php +++ b/core/modules/node/src/Form/NodeRevisionDeleteForm.php @@ -75,10 +75,10 @@ class NodeRevisionDeleteForm extends ConfirmFormBase { * {@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 cbd7e868ff0..da5cba023c1 100644 --- a/core/modules/node/src/Form/NodeRevisionRevertForm.php +++ b/core/modules/node/src/Form/NodeRevisionRevertForm.php @@ -67,7 +67,7 @@ class NodeRevisionRevertForm extends ConfirmFormBase { */ 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 a6a4d85d8af..c4f78c31255 100644 --- a/core/modules/node/src/Form/NodeRevisionRevertTranslationForm.php +++ b/core/modules/node/src/Form/NodeRevisionRevertTranslationForm.php @@ -53,7 +53,7 @@ class NodeRevisionRevertTranslationForm extends NodeRevisionRevertForm { */ 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 93e18c09ae2..ba8726d5374 100644 --- a/core/modules/node/src/Plugin/Condition/NodeType.php +++ b/core/modules/node/src/Plugin/Condition/NodeType.php @@ -53,7 +53,7 @@ class NodeType extends ConditionPluginBase implements ContainerFactoryPluginInte */ 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 f5eb9cc64bd..215a73c8a23 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 @@ class Node extends DrupalSqlBase { $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 434007a0a20..2a938af4782 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 @@ class ViewMode extends ViewModeBase { 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 8018d4d01b4..4a8cce4408e 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 @@ class Node extends FieldableEntity { $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 3680ee738bb..382b66643ed 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 @@ class Nid extends NumericArgument { $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 1a78c2faf06..135e3952cb3 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 @@ class Type extends StringArgument { * {@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 32de757c60a..ff1c0aca670 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 @@ class Vid extends NumericArgument { $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 642fba31b82..014f9813636 100644 --- a/core/modules/node/tests/src/Functional/NodeEditFormTest.php +++ b/core/modules/node/tests/src/Functional/NodeEditFormTest.php @@ -47,7 +47,7 @@ class NodeEditFormTest extends NodeTestBase { $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 df4ea12ab4f..ba95a5eb3a2 100644 --- a/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php +++ b/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php @@ -109,7 +109,7 @@ class NodeRevisionsAllTest extends NodeTestBase { * 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 78afe4a271f..9571f79fa64 100644 --- a/core/modules/node/tests/src/Functional/NodeRevisionsTest.php +++ b/core/modules/node/tests/src/Functional/NodeRevisionsTest.php @@ -134,7 +134,7 @@ class NodeRevisionsTest extends NodeTestBase { * 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 @@ class NodeRevisionsTest extends NodeTestBase { * 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 @@ class NodeRevisionsTest extends NodeTestBase { ]); $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 c7a84f86d9c..7d58b339277 100644 --- a/core/modules/node/tests/src/Functional/NodeRevisionsUiBypassAccessTest.php +++ b/core/modules/node/tests/src/Functional/NodeRevisionsUiBypassAccessTest.php @@ -50,7 +50,7 @@ class NodeRevisionsUiBypassAccessTest extends NodeTestBase { $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 4b04a77b120..625a84cbd22 100644 --- a/core/modules/node/tests/src/Functional/NodeRevisionsUiTest.php +++ b/core/modules/node/tests/src/Functional/NodeRevisionsUiTest.php @@ -38,7 +38,7 @@ class NodeRevisionsUiTest extends NodeTestBase { */ 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 eded04530d0..823093b9064 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 @@ class BulkFormTest extends NodeTestBase { */ 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 618119c0616..29fd702d963 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 420b30661e5..8949d0b4ce4 100644 --- a/core/modules/node/tests/src/Kernel/NodeListBuilderTest.php +++ b/core/modules/node/tests/src/Kernel/NodeListBuilderTest.php @@ -28,7 +28,7 @@ class NodeListBuilderTest extends KernelTestBase { */ 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 e943c91e578..3d7a2d6199e 100644 --- a/core/modules/path/tests/src/Functional/PathLanguageTest.php +++ b/core/modules/path/tests/src/Functional/PathLanguageTest.php @@ -71,7 +71,7 @@ class PathLanguageTest extends PathTestBase { * 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 0f5aa8c8f66..4f6bc328286 100644 --- a/core/modules/quickedit/src/Form/QuickEditFieldForm.php +++ b/core/modules/quickedit/src/Form/QuickEditFieldForm.php @@ -64,7 +64,7 @@ class QuickEditFieldForm extends FormBase { 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 41b85880ab6..f756c9e28db 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 620dbcbb60d..62160d8795b 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 @@ class RdfMappingConfigEntityUnitTest extends UnitTestCase { ->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 362d7623ddc..dcd059cf777 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 @@ class ResponsiveImageFormatter extends ImageFormatterBase implements ContainerFa $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 c01bd85c5f1..ae9f7be86dd 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 @@ class ResponsiveImageFieldDisplayTest extends ImageFieldTestBase { 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 @@ class ResponsiveImageFieldDisplayTest extends ImageFieldTestBase { '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 @@ class ResponsiveImageFieldDisplayTest extends ImageFieldTestBase { '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 @@ class ResponsiveImageFieldDisplayTest extends ImageFieldTestBase { '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 @@ class ResponsiveImageFieldDisplayTest extends ImageFieldTestBase { '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 @@ class ResponsiveImageFieldDisplayTest extends ImageFieldTestBase { $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 36a3f731170..80d29dc3f41 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 6d79589d14d..919e1220dd4 100644 --- a/core/modules/rest/src/Plugin/Deriver/EntityDeriver.php +++ b/core/modules/rest/src/Plugin/Deriver/EntityDeriver.php @@ -49,7 +49,7 @@ class EntityDeriver implements ContainerDeriverInterface { */ 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 473c1924ee1..7255d3f4814 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 cc95ae0699f..75d74ac3173 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 @@ class EntitySearchPage extends EntityConfigBase { $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 a77d7357426..8be5cd8e4a4 100644 --- a/core/modules/search/tests/src/Functional/SearchCommentTest.php +++ b/core/modules/search/tests/src/Functional/SearchCommentTest.php @@ -89,7 +89,7 @@ class SearchCommentTest extends BrowserTestBase { * 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 b14e4e386eb..05e6684f254 100644 --- a/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php +++ b/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php @@ -43,7 +43,7 @@ class ShortcutSetDeleteForm extends EntityDeleteForm { 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 a71aba28e08..bcf9993cd02 100644 --- a/core/modules/shortcut/src/Form/SwitchShortcutSet.php +++ b/core/modules/shortcut/src/Form/SwitchShortcutSet.php @@ -45,7 +45,7 @@ class SwitchShortcutSet extends FormBase { */ 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 0cb843be76c..a2c956cae48 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 @@ class ShortcutSetUsers extends DestinationBase implements ContainerFactoryPlugin $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 3fe2734fb89..dbfd3a68800 100644 --- a/core/modules/shortcut/src/ShortcutAccessControlHandler.php +++ b/core/modules/shortcut/src/ShortcutAccessControlHandler.php @@ -43,7 +43,7 @@ class ShortcutAccessControlHandler extends EntityAccessControlHandler implements 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 636813cc8f5..5db2f939891 100644 --- a/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php +++ b/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php @@ -38,7 +38,7 @@ class ShortcutSetsTest extends ShortcutTestBase { '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 547b27d363b..8e6cd82c944 100644 --- a/core/modules/system/src/Form/DateFormatFormBase.php +++ b/core/modules/system/src/Form/DateFormatFormBase.php @@ -50,7 +50,7 @@ abstract class DateFormatFormBase extends EntityForm { 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 5da50271720..d99c1454bef 100644 --- a/core/modules/system/src/Plugin/Derivative/SystemMenuBlock.php +++ b/core/modules/system/src/Plugin/Derivative/SystemMenuBlock.php @@ -36,7 +36,7 @@ class SystemMenuBlock extends DeriverBase implements ContainerDeriverInterface { */ 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 2aa64e86940..3e4257938ce 100644 --- a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php +++ b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php @@ -91,7 +91,7 @@ abstract class EntityCacheTagsTestBase extends PageCacheTagsTestBase { // 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 e92b6470016..2d9c5f29ec7 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 @@ abstract class EntityCacheTagsTestBase extends PageCacheTagsTestBase { // 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 4f0b7f0f71f..a82bb3e8593 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 @@ class EntityFormTest extends BrowserTestBase { 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 94225f4e97d..dec8dd8c713 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 @@ class EntityListBuilderTest extends BrowserTestBase { */ 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 3bbf9f98a0d..3bd84036864 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 @@ class EntityViewControllerTest extends BrowserTestBase { '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 3877b49ef9e..56e888d5c5f 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 @@ class PrepareUninstallTest extends BrowserTestBase { // 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 7a65474c7f5..8114ff4d4a3 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 @@ class TrustedHostsTest extends BrowserTestBase { $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 @@ class TrustedHostsTest extends BrowserTestBase { $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 26f5c2c9bf5..fd8f6cf1924 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 @@ class EntityUpdateAddRevisionDefaultTest extends UpdatePathTestBase { 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 e14820b9bd0..0a3ebbe992a 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 @@ class EntityUpdateAddRevisionTranslationAffectedTest extends UpdatePathTestBase 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 6c381d7c80f..dad380079f2 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 @@ class ActionTest extends KernelTestBase { // 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 0a33a88c645..54de7bf0b26 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 @@ class EntityReferenceSelectionReferenceableTest extends KernelTestBase { $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 3656a751ae3..75fe42cd767 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 763e14b131b..c806c33abdc 100644 --- a/core/modules/taxonomy/src/Form/VocabularyResetForm.php +++ b/core/modules/taxonomy/src/Form/VocabularyResetForm.php @@ -36,7 +36,7 @@ class VocabularyResetForm extends EntityConfirmFormBase { */ 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 57a2efabb16..120fa9c83c3 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 @@ class IndexTidDepth extends ArgumentPluginBase implements ContainerFactoryPlugin * {@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 b02b84fbab2..ee2a2ab34f5 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 @@ class Taxonomy extends NumericArgument implements ContainerFactoryPluginInterfac $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 3527ee584f7..c0e3e4e1e97 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 @@ class VocabularyVid extends NumericArgument { $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 6d8545b0ee5..eb1bc5a47b8 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 @@ class Tid extends ArgumentDefaultPluginBase implements CacheableDependencyInterf $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 7dda500d7c9..70ca470d9bf 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 @@ class TaxonomyIndexTid extends PrerenderList { $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 920bc0e33bc..5829681767c 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 @@ class TaxonomyIndexTid extends ManyToOne { $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 b757c23f425..5a88acea4d8 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 @@ class NodeTermData extends RelationshipPluginBase { $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 6a0b0d69a26..73df3c86903 100644 --- a/core/modules/taxonomy/src/TaxonomyPermissions.php +++ b/core/modules/taxonomy/src/TaxonomyPermissions.php @@ -45,7 +45,7 @@ class TaxonomyPermissions implements ContainerInjectionInterface { * {@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 d80b72b4deb..a9e13b8b93e 100644 --- a/core/modules/taxonomy/src/VocabularyForm.php +++ b/core/modules/taxonomy/src/VocabularyForm.php @@ -38,7 +38,7 @@ class VocabularyForm extends BundleEntityFormBase { */ 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 eb57142c87e..89de4c54989 100644 --- a/core/modules/taxonomy/tests/src/Functional/TaxonomyTermIndentationTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TaxonomyTermIndentationTest.php @@ -40,7 +40,7 @@ class TaxonomyTermIndentationTest extends TaxonomyTestBase { $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 87c2f5fbc1d..130569dbce0 100644 --- a/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php @@ -92,7 +92,7 @@ class TermIndexTest extends TaxonomyTestBase { * 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 0700023445d..ca283b33f63 100644 --- a/core/modules/taxonomy/tests/src/Functional/TermTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TermTest.php @@ -131,7 +131,7 @@ class TermTest extends TaxonomyTestBase { $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 @@ class TermTest extends TaxonomyTestBase { 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 @@ class TermTest extends TaxonomyTestBase { $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 @@ class TermTest extends TaxonomyTestBase { $this->assertEqual($edit['description[0][value]'], $term->getDescription(), 'Term description was successfully saved.'); // Check that the parent tid is still there. The other parent () 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 1fb01630bf6..659a9755136 100644 --- a/core/modules/taxonomy/tests/src/Functional/VocabularyCrudTest.php +++ b/core/modules/taxonomy/tests/src/Functional/VocabularyCrudTest.php @@ -124,7 +124,7 @@ class VocabularyCrudTest extends TaxonomyTestBase { $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 2620cb8fc47..7cddcc58199 100644 --- a/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php +++ b/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php @@ -99,7 +99,7 @@ class VocabularyUiTest extends TaxonomyTestBase { $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 @@ class VocabularyUiTest extends TaxonomyTestBase { $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 @@ class VocabularyUiTest extends TaxonomyTestBase { // 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 8e7d13de0e3..e16c70a30b8 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 @@ class MigrateTermNodeTest extends MigrateDrupal6TestBase { // 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 69d454c3795..51efcd35d71 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 @@ class MigrateTermNodeTranslationTest extends MigrateDrupal6TestBase { * 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 c2d9d667c97..9709b65efc9 100644 --- a/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php @@ -54,7 +54,7 @@ class TermKernelTest extends KernelTestBase { $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 @@ class TermKernelTest extends KernelTestBase { } // 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 7e7ce2b5e2e..489d70fc593 100644 --- a/core/modules/text/tests/src/Functional/TextFieldTest.php +++ b/core/modules/text/tests/src/Functional/TextFieldTest.php @@ -243,7 +243,7 @@ class TextFieldTest extends StringFieldTest { $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 f00d973f0f4..3846d3b38a9 100644 --- a/core/modules/user/src/AccountSettingsForm.php +++ b/core/modules/user/src/AccountSettingsForm.php @@ -53,7 +53,7 @@ class AccountSettingsForm extends ConfigFormBase { 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 6fbc0cd2f9e..b7cffa66192 100644 --- a/core/modules/user/src/Controller/UserController.php +++ b/core/modules/user/src/Controller/UserController.php @@ -73,7 +73,7 @@ class UserController extends ControllerBase { 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 ac5324abe65..ebdf1252140 100644 --- a/core/modules/user/src/Form/UserLoginForm.php +++ b/core/modules/user/src/Form/UserLoginForm.php @@ -71,7 +71,7 @@ class UserLoginForm extends FormBase { 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 7bb2f830ae8..8291ad5de4c 100644 --- a/core/modules/user/src/Form/UserPasswordForm.php +++ b/core/modules/user/src/Form/UserPasswordForm.php @@ -51,7 +51,7 @@ class UserPasswordForm extends FormBase { */ 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 0f7f0378daa..1ce0e117e0f 100644 --- a/core/modules/user/src/Form/UserPermissionsForm.php +++ b/core/modules/user/src/Form/UserPermissionsForm.php @@ -59,7 +59,7 @@ class UserPermissionsForm extends FormBase { 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 de4c4040fec..e496e1f9fa8 100644 --- a/core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php +++ b/core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php @@ -41,7 +41,7 @@ abstract class ChangeUserRoleBase extends ConfigurableActionBase implements Cont $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 5d462b66189..e606c5a8509 100644 --- a/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php +++ b/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php @@ -74,7 +74,7 @@ class UserSelection extends DefaultSelection { $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 a8b12af8f44..a35a0d9ad58 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 @@ class ProtectedUserFieldConstraintValidator extends ConstraintValidator implemen */ 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 d1fe8abcc24..c75c186babe 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 @@ class Role extends AccessPluginBase implements CacheableDependencyInterface { $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 4d909dcbd92..e45008cbf6e 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 @@ class RolesRid extends ManyToOne { * {@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 31f6c33af84..7a1e6c00204 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 @@ class Uid extends NumericArgument { * {@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 ac8c3184c46..705ba7a5892 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 @@ class Permissions extends PrerenderList { * {@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 a6986f2257c..83dfbb33704 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 @@ class Roles extends ManyToOne { $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 6c1004c9d43..d5346b1237e 100644 --- a/core/modules/user/tests/src/Functional/AccessRoleUITest.php +++ b/core/modules/user/tests/src/Functional/AccessRoleUITest.php @@ -40,14 +40,14 @@ class AccessRoleUITest extends UITestBase { * 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 @@ class AccessRoleUITest extends UITestBase { $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 d870ba56e28..298d41493ea 100644 --- a/core/modules/user/tests/src/Functional/UserAdminTest.php +++ b/core/modules/user/tests/src/Functional/UserAdminTest.php @@ -41,7 +41,7 @@ class UserAdminTest extends BrowserTestBase { $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 631b35183a7..365be54f48c 100644 --- a/core/modules/user/tests/src/Functional/UserCancelTest.php +++ b/core/modules/user/tests/src/Functional/UserCancelTest.php @@ -34,9 +34,9 @@ class UserCancelTest extends BrowserTestBase { * 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 @@ class UserCancelTest extends BrowserTestBase { * 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 @@ class UserCancelTest extends BrowserTestBase { * 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 @@ class UserCancelTest extends BrowserTestBase { */ 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 @@ class UserCancelTest extends BrowserTestBase { * 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 @@ class UserCancelTest extends BrowserTestBase { * 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 @@ class UserCancelTest extends BrowserTestBase { * 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 @@ class UserCancelTest extends BrowserTestBase { * 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 @@ class UserCancelTest extends BrowserTestBase { \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 7f810e064c8..e9c88b106f6 100644 --- a/core/modules/user/tests/src/Functional/UserLoginTest.php +++ b/core/modules/user/tests/src/Functional/UserLoginTest.php @@ -122,7 +122,7 @@ class UserLoginTest extends BrowserTestBase { $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 30ff65648e8..14b0ca854e6 100644 --- a/core/modules/user/tests/src/Functional/UserPermissionsTest.php +++ b/core/modules/user/tests/src/Functional/UserPermissionsTest.php @@ -45,7 +45,7 @@ class UserPermissionsTest extends BrowserTestBase { 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 d24d788684c..7e6cca79a78 100644 --- a/core/modules/user/tests/src/Functional/UserPictureTest.php +++ b/core/modules/user/tests/src/Functional/UserPictureTest.php @@ -147,7 +147,7 @@ class UserPictureTest extends BrowserTestBase { $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 ce1568d8387..766baf304c2 100644 --- a/core/modules/user/tests/src/Functional/UserRegistrationTest.php +++ b/core/modules/user/tests/src/Functional/UserRegistrationTest.php @@ -57,7 +57,7 @@ class UserRegistrationTest extends BrowserTestBase { $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 @@ class UserRegistrationTest extends BrowserTestBase { $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 c0ee2d17279..6cd80562c54 100644 --- a/core/modules/user/tests/src/Functional/UserRolesAssignmentTest.php +++ b/core/modules/user/tests/src/Functional/UserRolesAssignmentTest.php @@ -80,7 +80,7 @@ class UserRolesAssignmentTest extends BrowserTestBase { * 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 29c0e83e6b9..a9ba63feed6 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 fe967b2d9f6..2e44cf4c251 100644 --- a/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php +++ b/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php @@ -132,10 +132,10 @@ class UserAccountFormFieldsTest extends KernelTestBase { 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 73fe869ec3d..6d96172cceb 100644 --- a/core/modules/user/tests/src/Kernel/UserEntityTest.php +++ b/core/modules/user/tests/src/Kernel/UserEntityTest.php @@ -37,7 +37,7 @@ class UserEntityTest extends KernelTestBase { * @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 cac470aaab8..4fa03df04cd 100644 --- a/core/modules/user/tests/src/Kernel/UserRoleDeleteTest.php +++ b/core/modules/user/tests/src/Kernel/UserRoleDeleteTest.php @@ -31,7 +31,7 @@ class UserRoleDeleteTest extends KernelTestBase { */ 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 0e862c86b89..c788cafbecf 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 @@ abstract class UserKernelTestBase extends ViewsKernelTestBase { $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 ff4a53e0e96..53beacb0ce1 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 @@ class RolesRidTest extends UnitTestCase { ->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 @@ class RolesRidTest extends UnitTestCase { // 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 88ad2b52bd7..1bc6e3e367c 100644 --- a/core/modules/views/src/Controller/ViewAjaxController.php +++ b/core/modules/views/src/Controller/ViewAjaxController.php @@ -90,7 +90,7 @@ class ViewAjaxController implements ContainerInjectionInterface { */ 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 4b7d86d2729..26dbf5be86c 100644 --- a/core/modules/views/src/Plugin/Block/ViewsBlockBase.php +++ b/core/modules/views/src/Plugin/Block/ViewsBlockBase.php @@ -81,7 +81,7 @@ abstract class ViewsBlockBase extends BlockBase implements ContainerFactoryPlugi 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 51993ae4021..4d9d0f23f5f 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 bdbeacc35c8..85ca1c46d9b 100644 --- a/core/modules/views/src/Plugin/Derivative/ViewsEntityRow.php +++ b/core/modules/views/src/Plugin/Derivative/ViewsEntityRow.php @@ -73,7 +73,7 @@ class ViewsEntityRow implements ContainerDeriverInterface { 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 f700f16aceb..0dcf62ee3d3 100644 --- a/core/modules/views/src/Plugin/Derivative/ViewsExposedFilterBlock.php +++ b/core/modules/views/src/Plugin/Derivative/ViewsExposedFilterBlock.php @@ -53,7 +53,7 @@ class ViewsExposedFilterBlock 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/ViewsLocalTask.php b/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php index bc6400c0189..6bf6254d07d 100644 --- a/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php +++ b/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php @@ -59,7 +59,7 @@ class ViewsLocalTask extends DeriverBase implements ContainerDeriverInterface { 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 40dfe44a205..c73846514b0 100644 --- a/core/modules/views/src/Plugin/Derivative/ViewsMenuLink.php +++ b/core/modules/views/src/Plugin/Derivative/ViewsMenuLink.php @@ -38,7 +38,7 @@ class ViewsMenuLink extends DeriverBase implements ContainerDeriverInterface { */ 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 79707af10a2..6def8d8fefb 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 ab8c42ac248..9ea7c51fe32 100644 --- a/core/modules/views/src/Plugin/Menu/ViewsMenuLink.php +++ b/core/modules/views/src/Plugin/Menu/ViewsMenuLink.php @@ -85,7 +85,7 @@ class ViewsMenuLink extends MenuLinkBase implements ContainerFactoryPluginInterf $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 27c8d487588..932e7a6a259 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 @@ class View extends AreaPluginBase { $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 cf6d65a1f89..bcdab29ecd3 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 @@ class Block extends DisplayPluginBase { $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 23409ec56da..3816ee179f1 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 @@ class Page extends PathPluginBase { $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 33b1afb015a..5ee5891d9de 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 @@ class BulkForm extends FieldPluginBase implements CacheableDependencyInterface { $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 aff879c5d53..639bc2329af 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 @@ class Date extends FieldPluginBase { $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 86ccd05449a..9d7dbfe6f98 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 @@ class EntityLabel extends FieldPluginBase { $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager') + $container->get('entity_type.manager') ); } @@ -136,7 +136,7 @@ class EntityLabel extends FieldPluginBase { } 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 29e9ac5b32a..147e26104ae 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 @@ class Bundle extends InOperator { $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 32cf016fd41..d34380c0787 100644 --- a/core/modules/views/src/Views.php +++ b/core/modules/views/src/Views.php @@ -119,7 +119,7 @@ class Views { * 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 278a1ec7b9d..86b0d941f85 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 a4ae23aa487..76bcc80fd20 100644 --- a/core/modules/views/tests/src/Functional/DefaultViewsTest.php +++ b/core/modules/views/tests/src/Functional/DefaultViewsTest.php @@ -121,7 +121,7 @@ class DefaultViewsTest extends ViewTestBase { */ 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 1d78204db9a..32081addb25 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 @@ class CacheTagTest extends ViewTestBase { $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 708ac550303..a85612cca28 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 @@ class DisabledDisplayTest extends ViewTestBase { $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 6599a4416fd..94baae3dea1 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 @@ class DisplayFeedTest extends ViewTestBase { // 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 bf0f2a1adba..90f027c7f50 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 @@ class StyleOpmlTest extends ViewTestBase { '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 @@ class StyleOpmlTest extends ViewTestBase { $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 0d3ce325d44..1cc6ea80793 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 @@ class AreaEntityTest extends ViewsKernelTestBase { */ 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 @@ class AreaEntityTest extends ViewsKernelTestBase { 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 3ea46f0dd06..a05558f8e1a 100644 --- a/core/modules/views/tests/src/Kernel/ModuleTest.php +++ b/core/modules/views/tests/src/Kernel/ModuleTest.php @@ -141,7 +141,7 @@ class ModuleTest extends ViewsKernelTestBase { $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 a6776b585a1..f24e956032b 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 25d8b4a4c1d..256192ba1ea 100644 --- a/core/modules/views/tests/src/Kernel/QueryGroupByTest.php +++ b/core/modules/views/tests/src/Kernel/QueryGroupByTest.php @@ -46,7 +46,7 @@ class QueryGroupByTest extends ViewsKernelTestBase { $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 cb548c0afba..44036c6b0a3 100644 --- a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php +++ b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php @@ -261,7 +261,7 @@ class ViewExecutableTest extends ViewsKernelTestBase { $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 b60df267b34..b192048d913 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 fb19ac1be5c..be0a70c3d10 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 @@ class EntityTest extends UnitTestCase { /** * 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 @@ class EntityTest extends UnitTestCase { * @covers ::init */ public function testRenderWithId() { - $this->setupEntityManager(); + $this->setupEntityTypeManager(); $options = [ 'target' => 1, 'tokenize' => FALSE, @@ -192,7 +192,7 @@ class EntityTest extends UnitTestCase { * @dataProvider providerTestTokens */ public function testRenderWithIdAndToken($token, $id) { - $this->setupEntityManager(); + $this->setupEntityTypeManager(); $options = [ 'target' => $token, 'tokenize' => TRUE, @@ -231,7 +231,7 @@ class EntityTest extends UnitTestCase { * @covers ::init */ public function testRenderWithUuid() { - $this->setupEntityManager(); + $this->setupEntityTypeManager(); $uuid = '1d52762e-b9d8-4177-908f-572d1a5845a4'; $options = [ 'target' => $uuid, @@ -264,7 +264,7 @@ class EntityTest extends UnitTestCase { * @dataProvider providerTestTokens */ public function testCalculateDependenciesWithPlaceholder($token, $id) { - $this->setupEntityManager(); + $this->setupEntityTypeManager(); $options = [ 'target' => $token, @@ -278,7 +278,7 @@ class EntityTest extends UnitTestCase { * @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 @@ class EntityTest extends UnitTestCase { * @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 e94068f051f..0273fb2bccd 100644 --- a/core/modules/views/tests/src/Unit/ViewsTest.php +++ b/core/modules/views/tests/src/Unit/ViewsTest.php @@ -59,12 +59,12 @@ class ViewsTest extends UnitTestCase { ->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 4a45d85feef..6a348b70d4a 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 @@ class GroupByTest extends UITestBase { $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 7d96d0c5b57..e37c61f4665 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 @@ class HandlerTest extends UITestBase { // 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 @@ class HandlerTest extends UITestBase { $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 @@ class HandlerTest extends UITestBase { $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 bfe5b05d071..645bac54a81 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 @@ class ViewEditTest extends UITestBase { $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 @@ class ViewEditTest extends UITestBase { $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 4ceebf5b9b3..7f3e44bb404 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/CacheabilityMetadataConfigOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/CacheabilityMetadataConfigOverrideTest.php @@ -63,9 +63,9 @@ class CacheabilityMetadataConfigOverrideTest extends KernelTestBase { // 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 e9259c52e81..2889d9d65f9 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php @@ -43,7 +43,7 @@ class ConfigDependencyTest extends EntityKernelTestBase { 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 @@ class ConfigDependencyTest extends EntityKernelTestBase { // 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 @@ class ConfigDependencyTest extends EntityKernelTestBase { /** @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 @@ class ConfigDependencyTest extends EntityKernelTestBase { /** @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 @@ class ConfigDependencyTest extends EntityKernelTestBase { /** @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 @@ class ConfigDependencyTest extends EntityKernelTestBase { $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 fcc472f9e2c..0f8609cc24b 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 06e312383da..254dc7af44f 100644 --- a/core/tests/Drupal/KernelTests/Core/Datetime/DateFormatterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Datetime/DateFormatterTest.php @@ -36,7 +36,7 @@ class DateFormatterTest extends KernelTestBase { '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 613ba4e17dd..3c2e3aee1c5 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php @@ -49,14 +49,14 @@ class BundleConstraintValidatorTest extends KernelTestBase { ->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 c3eb8ef583c..2ce4ef53895 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php @@ -174,7 +174,7 @@ class EntityAccessControlHandlerTest extends EntityLanguageTestBase { // 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 3671d6d408e..e9edd672d12 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php @@ -38,7 +38,7 @@ class EntityTypeConstraintValidatorTest extends EntityKernelTestBase { ); // 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 68129909f32..4172772be78 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php @@ -49,12 +49,12 @@ class EntityViewBuilderTest extends EntityKernelTestBase { // 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 @@ class EntityViewBuilderTest extends EntityKernelTestBase { $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 @@ class EntityViewBuilderTest extends EntityKernelTestBase { $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 @@ class EntityViewBuilderTest extends EntityKernelTestBase { // 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 @@ class EntityViewBuilderTest extends EntityKernelTestBase { // 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 @@ class EntityViewBuilderTest extends EntityKernelTestBase { '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 76e7004d23c..7e9300c7aae 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php @@ -104,7 +104,7 @@ class FieldSqlStorageTest extends EntityKernelTestBase { */ 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 @@ class FieldSqlStorageTest extends EntityKernelTestBase { // 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 @@ class FieldSqlStorageTest extends EntityKernelTestBase { } // 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 0f1ffc47eec..3426463b3ba 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 @@ class EntityDisplayModeBaseUnitTest extends UnitTestCase { $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 01d9ae2560a..2c6e0ff5840 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\DependencyInjection\Container; 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 @@ class EntityFormDisplayAccessControlHandlerTest extends UnitTestCase { ->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 @@ class EntityFormDisplayAccessControlHandlerTest extends UnitTestCase { $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 52cdd7621fc..b2a9922f64e 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\DependencyInjection\ContainerBuilder; 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 @@ class ContentEntityBaseUnitTest extends UnitTestCase { 'uuid' => 'uuid', ])); - $this->entityManager = new EntityManager(); - $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class); $this->entityTypeManager->expects($this->any()) ->method('getDefinition') @@ -199,7 +189,6 @@ class ContentEntityBaseUnitTest extends UnitTestCase { ->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 @@ class ContentEntityBaseUnitTest extends UnitTestCase { $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 87b8a68fc1c..e5c07af5ac9 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php @@ -189,7 +189,7 @@ class EntityFieldManagerTest extends UnitTestCase { $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 @@ class EntityFieldManagerTest extends UnitTestCase { $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 @@ class EntityFieldManagerTest extends UnitTestCase { $field_definition->setTranslatable(!$translatable)->shouldBeCalled(); } - $entity_class = EntityManagerTestEntity::class; + $entity_class = EntityTypeManagerTestEntity::class; $entity_class::$baseFieldDefinitions += ['langcode' => $field_definition->reveal()]; } @@ -515,7 +515,7 @@ class EntityFieldManagerTest extends UnitTestCase { $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 @@ class EntityFieldManagerTest extends UnitTestCase { // 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 @@ class EntityFieldManagerTest extends UnitTestCase { 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 @@ class TestEntityFieldManager extends EntityFieldManager { /** * 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 e95b7844fc8..c12a6b04d7b 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php @@ -5,16 +5,23 @@ namespace Drupal\Tests\Core\Entity; 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 @@ class EntityManagerTest extends UnitTestCase { $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 d4e0442010f..4eb2d13a093 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php @@ -116,7 +116,7 @@ class EntityTypeBundleInfoTest extends UnitTestCase { $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 915ecd68181..b9554e33709 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php @@ -53,7 +53,7 @@ class EntityTypeRepositoryTest extends UnitTestCase { $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 7027d7f707c..262e8991e9a 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php @@ -576,12 +576,12 @@ class EntityUrlTest extends UnitTestCase { * 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 0715ca78061..f152149ab07 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\DependencyInjection\ContainerBuilder; 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 @@ class KeyValueEntityStorageTest extends UnitTestCase { ->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 @@ class KeyValueEntityStorageTest extends UnitTestCase { $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 2881f39a5a9..cd28156ad37 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 @@ namespace Drupal\Tests\Core\Entity\TypedData; 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 @@ class EntityAdapterUnitTest extends UnitTestCase { 'uuid' => 'uuid', ])); - $this->entityManager = new EntityManager(); - $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class); $this->entityTypeManager->expects($this->any()) ->method('getDefinition') @@ -204,16 +194,12 @@ class EntityAdapterUnitTest extends UnitTestCase { $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 1312f40c80c..2177cd860af 100644 --- a/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php +++ b/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php @@ -72,16 +72,16 @@ class FieldDefinitionListenerTest extends UnitTestCase { } /** - * 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 @@ class FieldDefinitionListenerTest extends UnitTestCase { $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 @@ class FieldDefinitionListenerTest extends UnitTestCase { $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 @@ class FieldDefinitionListenerTest extends UnitTestCase { $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 @@ class FieldDefinitionListenerTest extends UnitTestCase { $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 @@ class FieldDefinitionListenerTest extends UnitTestCase { $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 bd75541d20d..155d2b6fb2e 100644 --- a/core/tests/Drupal/Tests/EntityViewTrait.php +++ b/core/tests/Drupal/Tests/EntityViewTrait.php @@ -58,7 +58,7 @@ trait EntityViewTrait { } }; - $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()]); }