diff --git a/phpcs-ruleset.xml.dist b/phpcs-ruleset.xml.dist index 15c9ceb90..b921ac9bd 100644 --- a/phpcs-ruleset.xml.dist +++ b/phpcs-ruleset.xml.dist @@ -32,8 +32,6 @@ - - diff --git a/src/GroupTypeManager.php b/src/GroupTypeManager.php index 40ed91939..0cbd48e74 100644 --- a/src/GroupTypeManager.php +++ b/src/GroupTypeManager.php @@ -131,6 +131,13 @@ class GroupTypeManager implements GroupTypeManagerInterface { */ protected $groupAudienceHelper; + /** + * The Entity type manager service. + * + * @var \Drupal\Core\Entity\EntityTypeManagerInterface + */ + protected $entityTypeManager; + /** * Constructs a GroupTypeManager object. * @@ -155,6 +162,7 @@ class GroupTypeManager implements GroupTypeManagerInterface { */ public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info, EventDispatcherInterface $event_dispatcher, CacheBackendInterface $cache, PermissionManagerInterface $permission_manager, OgRoleManagerInterface $og_role_manager, RouteBuilderInterface $route_builder, OgGroupAudienceHelperInterface $group_audience_helper) { $this->configFactory = $config_factory; + $this->entityTypeManager = $entity_type_manager; $this->entityTypeBundleInfo = $entity_type_bundle_info; $this->eventDispatcher = $event_dispatcher; $this->cache = $cache; @@ -377,7 +385,7 @@ protected function populateGroupRelationMap(): void { $this->groupRelationMap = []; - $user_bundles = \Drupal::entityTypeManager()->getDefinition('user')->getKey('bundle') ?: ['user']; + $user_bundles = $this->entityTypeManager->getDefinition('user')->getKey('bundle') ?: ['user']; foreach ($this->entityTypeBundleInfo->getAllBundleInfo() as $group_content_entity_type_id => $bundles) { foreach ($bundles as $group_content_bundle_id => $bundle_info) {