Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3338541
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3338541
Commits
ad0506ce
Unverified
Commit
ad0506ce
authored
6 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3031346
by martin107, Berdir: Replace EntityManager usage in ConfigEntityMapper
parent
9096cb6b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/modules/config_translation/src/ConfigEntityMapper.php
+20
-10
20 additions, 10 deletions
core/modules/config_translation/src/ConfigEntityMapper.php
core/modules/config_translation/src/ConfigFieldMapper.php
+3
-3
3 additions, 3 deletions
core/modules/config_translation/src/ConfigFieldMapper.php
with
23 additions
and
13 deletions
core/modules/config_translation/src/ConfigEntityMapper.php
+
20
−
10
View file @
ad0506ce
...
...
@@ -5,7 +5,8 @@
use
Drupal\Core\Config\ConfigFactoryInterface
;
use
Drupal\Core\Config\Entity\ConfigEntityInterface
;
use
Drupal\Core\Config\TypedConfigManagerInterface
;
use
Drupal\Core\Entity\EntityManagerInterface
;
use
Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait
;
use
Drupal\Core\Entity\EntityTypeManagerInterface
;
use
Drupal\Core\Language\LanguageManagerInterface
;
use
Drupal\Core\Routing\RouteMatchInterface
;
use
Drupal\Core\Routing\RouteProviderInterface
;
...
...
@@ -21,12 +22,21 @@
*/
class
ConfigEntityMapper
extends
ConfigNamesMapper
{
use
DeprecatedServicePropertyTrait
;
/**
* {@inheritdoc}
*/
protected
$deprecatedProperties
=
[
'entityManager'
=>
'entity.manager'
,
];
/**
* The entity manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\Entity
Type
ManagerInterface
*/
protected
$entityManager
;
protected
$entity
Type
Manager
;
/**
* Configuration entity type name.
...
...
@@ -70,18 +80,18 @@ class ConfigEntityMapper extends ConfigNamesMapper {
* The route provider.
* @param \Drupal\Core\StringTranslation\TranslationInterface $translation_manager
* The string translation manager.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* @param \Drupal\Core\Entity\Entity
Type
ManagerInterface $entity_
type_
manager
* The entity manager.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
* The event dispatcher.
*/
public
function
__construct
(
$plugin_id
,
$plugin_definition
,
ConfigFactoryInterface
$config_factory
,
TypedConfigManagerInterface
$typed_config
,
LocaleConfigManager
$locale_config_manager
,
ConfigMapperManagerInterface
$config_mapper_manager
,
RouteProviderInterface
$route_provider
,
TranslationInterface
$translation_manager
,
EntityManagerInterface
$entity_manager
,
LanguageManagerInterface
$language_manager
,
EventDispatcherInterface
$event_dispatcher
=
NULL
)
{
public
function
__construct
(
$plugin_id
,
$plugin_definition
,
ConfigFactoryInterface
$config_factory
,
TypedConfigManagerInterface
$typed_config
,
LocaleConfigManager
$locale_config_manager
,
ConfigMapperManagerInterface
$config_mapper_manager
,
RouteProviderInterface
$route_provider
,
TranslationInterface
$translation_manager
,
Entity
Type
ManagerInterface
$entity_
type_
manager
,
LanguageManagerInterface
$language_manager
,
EventDispatcherInterface
$event_dispatcher
=
NULL
)
{
parent
::
__construct
(
$plugin_id
,
$plugin_definition
,
$config_factory
,
$typed_config
,
$locale_config_manager
,
$config_mapper_manager
,
$route_provider
,
$translation_manager
,
$language_manager
,
$event_dispatcher
);
$this
->
setType
(
$plugin_definition
[
'entity_type'
]);
$this
->
entityManager
=
$entity_manager
;
$this
->
entity
Type
Manager
=
$entity_
type_
manager
;
}
/**
...
...
@@ -99,7 +109,7 @@ public static function create(ContainerInterface $container, array $configuratio
$container
->
get
(
'plugin.manager.config_translation.mapper'
),
$container
->
get
(
'router.route_provider'
),
$container
->
get
(
'string_translation'
),
$container
->
get
(
'entity.manager'
),
$container
->
get
(
'entity
_type
.manager'
),
$container
->
get
(
'language_manager'
),
$container
->
get
(
'event_dispatcher'
)
);
...
...
@@ -152,7 +162,7 @@ public function setEntity(ConfigEntityInterface $entity) {
// entity. This is not a Drupal 8 best practice (ideally the configuration
// would have pluggable components), but this may happen as well.
/** @var \Drupal\Core\Config\Entity\ConfigEntityTypeInterface $entity_type_info */
$entity_type_info
=
$this
->
entityManager
->
getDefinition
(
$this
->
entityType
);
$entity_type_info
=
$this
->
entity
Type
Manager
->
getDefinition
(
$this
->
entityType
);
$this
->
addConfigName
(
$entity_type_info
->
getConfigPrefix
()
.
'.'
.
$entity
->
id
());
return
TRUE
;
...
...
@@ -208,7 +218,7 @@ public function getType() {
* {@inheritdoc}
*/
public
function
getTypeName
()
{
$entity_type_info
=
$this
->
entityManager
->
getDefinition
(
$this
->
entityType
);
$entity_type_info
=
$this
->
entity
Type
Manager
->
getDefinition
(
$this
->
entityType
);
return
$entity_type_info
->
getLabel
();
}
...
...
@@ -216,7 +226,7 @@ public function getTypeName() {
* {@inheritdoc}
*/
public
function
getTypeLabel
()
{
$entityType
=
$this
->
entityManager
->
getDefinition
(
$this
->
entityType
);
$entityType
=
$this
->
entity
Type
Manager
->
getDefinition
(
$this
->
entityType
);
return
$entityType
->
getLabel
();
}
...
...
This diff is collapsed.
Click to expand it.
core/modules/config_translation/src/ConfigFieldMapper.php
+
3
−
3
View file @
ad0506ce
...
...
@@ -26,7 +26,7 @@ class ConfigFieldMapper extends ConfigEntityMapper {
*/
public
function
getBaseRouteParameters
()
{
$parameters
=
parent
::
getBaseRouteParameters
();
$base_entity_info
=
$this
->
entityManager
->
getDefinition
(
$this
->
pluginDefinition
[
'base_entity_type'
]);
$base_entity_info
=
$this
->
entity
Type
Manager
->
getDefinition
(
$this
->
pluginDefinition
[
'base_entity_type'
]);
$bundle_parameter_key
=
$base_entity_info
->
getBundleEntityType
()
?:
'bundle'
;
$parameters
[
$bundle_parameter_key
]
=
$this
->
entity
->
getTargetBundle
();
return
$parameters
;
...
...
@@ -43,7 +43,7 @@ public function getOverviewRouteName() {
* {@inheritdoc}
*/
public
function
getTypeLabel
()
{
$base_entity_info
=
$this
->
entityManager
->
getDefinition
(
$this
->
pluginDefinition
[
'base_entity_type'
]);
$base_entity_info
=
$this
->
entity
Type
Manager
->
getDefinition
(
$this
->
pluginDefinition
[
'base_entity_type'
]);
return
$this
->
t
(
'@label fields'
,
[
'@label'
=>
$base_entity_info
->
getLabel
()]);
}
...
...
@@ -58,7 +58,7 @@ public function setEntity(ConfigEntityInterface $entity) {
/** @var \Drupal\field\FieldStorageConfigInterface $field_storage */
$field_storage
=
$this
->
entity
->
getFieldStorageDefinition
();
/** @var \Drupal\Core\Config\Entity\ConfigEntityTypeInterface $entity_type_info */
$entity_type_info
=
$this
->
entityManager
->
getDefinition
(
$field_storage
->
getEntityTypeId
());
$entity_type_info
=
$this
->
entity
Type
Manager
->
getDefinition
(
$field_storage
->
getEntityTypeId
());
$this
->
addConfigName
(
$entity_type_info
->
getConfigPrefix
()
.
'.'
.
$field_storage
->
id
());
return
TRUE
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment