Issue #3042545 by Berdir, martin107: Update last injected entity managers

merge-requests/1119/head
Lee Rowlands 2019-04-11 18:51:08 +10:00
parent 3ddb6b94eb
commit 12d7ed5308
No known key found for this signature in database
GPG Key ID: 2B829A3DF9204DC4
34 changed files with 460 additions and 278 deletions

View File

@ -6,7 +6,7 @@ use Drupal\Component\Render\PlainTextOutput;
use Drupal\Component\Utility\EmailValidatorInterface;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Action\ConfigurableActionBase;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Mail\MailManagerInterface;
@ -80,7 +80,7 @@ class EmailAction extends ConfigurableActionBase implements ContainerFactoryPlug
* The plugin implementation definition.
* @param \Drupal\Core\Utility\Token $token
* The token service.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity manager.
* @param \Psr\Log\LoggerInterface $logger
* A logger instance.
@ -91,11 +91,11 @@ class EmailAction extends ConfigurableActionBase implements ContainerFactoryPlug
* @param \Drupal\Component\Utility\EmailValidatorInterface $email_validator
* The email validator.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, Token $token, EntityManagerInterface $entity_manager, LoggerInterface $logger, MailManagerInterface $mail_manager, LanguageManagerInterface $language_manager, EmailValidatorInterface $email_validator) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, Token $token, EntityTypeManagerInterface $entity_type_manager, LoggerInterface $logger, MailManagerInterface $mail_manager, LanguageManagerInterface $language_manager, EmailValidatorInterface $email_validator) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->token = $token;
$this->storage = $entity_manager->getStorage('user');
$this->storage = $entity_type_manager->getStorage('user');
$this->logger = $logger;
$this->mailManager = $mail_manager;
$this->languageManager = $language_manager;

View File

@ -3,7 +3,8 @@
namespace Drupal\Core\Entity\Plugin\DataType\Deriver;
use Drupal\Core\Config\Entity\ConfigEntityInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Entity\Plugin\DataType\ConfigEntityAdapter;
use Drupal\Core\Entity\Plugin\DataType\EntityAdapter;
@ -14,6 +15,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* Provides data type plugins for each existing entity type and bundle.
*/
class EntityDeriver implements ContainerDeriverInterface {
use DeprecatedServicePropertyTrait;
/**
* {@inheritdoc}
*/
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* List of derivative definitions.
@ -30,11 +37,11 @@ class EntityDeriver implements ContainerDeriverInterface {
protected $basePluginId;
/**
* The entity manager.
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityManager;
protected $entityTypeManager;
/**
* The bundle info service.
@ -48,12 +55,12 @@ class EntityDeriver implements ContainerDeriverInterface {
*
* @param string $base_plugin_id
* The base plugin ID.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct($base_plugin_id, EntityManagerInterface $entity_manager, EntityTypeBundleInfoInterface $bundle_info_service) {
public function __construct($base_plugin_id, EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleInfoInterface $bundle_info_service) {
$this->basePluginId = $base_plugin_id;
$this->entityManager = $entity_manager;
$this->entityTypeManager = $entity_type_manager;
$this->bundleInfoService = $bundle_info_service;
}
@ -88,7 +95,7 @@ class EntityDeriver implements ContainerDeriverInterface {
// Also keep the 'entity' defined as is.
$this->derivatives[''] = $base_plugin_definition;
// Add definitions for each entity type and bundle.
foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) {
foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) {
$class = $entity_type->entityClassImplements(ConfigEntityInterface::class) ? ConfigEntityAdapter::class : EntityAdapter::class;
$this->derivatives[$entity_type_id] = [
'class' => $class,

View File

@ -3,7 +3,8 @@
namespace Drupal\Core\Entity\Plugin\Derivative;
use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -17,22 +18,28 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @see plugin_api
*/
class DefaultSelectionDeriver extends DeriverBase implements ContainerDeriverInterface {
use DeprecatedServicePropertyTrait;
/**
* The entity manager
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* {@inheritdoc}
*/
protected $entityManager;
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Creates an SelectionBase object.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(EntityManagerInterface $entity_manager) {
$this->entityManager = $entity_manager;
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**
@ -40,7 +47,7 @@ class DefaultSelectionDeriver extends DeriverBase implements ContainerDeriverInt
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static(
$container->get('entity.manager')
$container->get('entity_type.manager')
);
}
@ -48,7 +55,7 @@ class DefaultSelectionDeriver extends DeriverBase implements ContainerDeriverInt
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) {
foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) {
$this->derivatives[$entity_type_id] = $base_plugin_definition;
$this->derivatives[$entity_type_id]['entity_types'] = [$entity_type_id];
$this->derivatives[$entity_type_id]['label'] = t('@entity_type selection', ['@entity_type' => $entity_type->getLabel()]);

View File

@ -2,7 +2,8 @@
namespace Drupal\aggregator\Plugin\views\argument;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\views\Plugin\views\argument\NumericArgument;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -14,13 +15,19 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @ViewsArgument("aggregator_fid")
*/
class Fid extends NumericArgument {
use DeprecatedServicePropertyTrait;
/**
* The entity manager service.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* {@inheritdoc}
*/
protected $entityManager;
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a \Drupal\aggregator\Plugin\views\argument\Fid object.
@ -31,19 +38,19 @@ class Fid extends NumericArgument {
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_manager
* The entity type manager.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityManager = $entity_manager;
$this->entityTypeManager = $entity_manager;
}
/**
* {@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'));
}
/**
@ -52,7 +59,7 @@ class Fid extends NumericArgument {
public function titleQuery() {
$titles = [];
$feeds = $this->entityManager->getStorage('aggregator_feed')->loadMultiple($this->value);
$feeds = $this->entityTypeManager->getStorage('aggregator_feed')->loadMultiple($this->value);
foreach ($feeds as $feed) {
$titles[] = $feed->label();
}

View File

@ -2,7 +2,8 @@
namespace Drupal\aggregator\Plugin\views\argument;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\views\Plugin\views\argument\NumericArgument;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -14,13 +15,19 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @ViewsArgument("aggregator_iid")
*/
class Iid extends NumericArgument {
use DeprecatedServicePropertyTrait;
/**
* The entity manager service.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* {@inheritdoc}
*/
protected $entityManager;
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a \Drupal\aggregator\Plugin\views\argument\Iid object.
@ -31,12 +38,12 @@ class Iid extends NumericArgument {
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityManager = $entity_manager;
$this->entityTypeManager = $entity_type_manager;
}
/**
@ -52,7 +59,7 @@ class Iid extends NumericArgument {
public function titleQuery() {
$titles = [];
$items = $this->entityManager->getStorage('aggregator_item')->loadMultiple($this->value);
$items = $this->entityTypeManager->getStorage('aggregator_item')->loadMultiple($this->value);
foreach ($items as $feed) {
$titles[] = $feed->label();
}

View File

@ -3,10 +3,11 @@
namespace Drupal\block;
use Drupal\Component\Utility\Html;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Plugin\PluginFormFactoryInterface;
use Drupal\Core\Block\BlockPluginInterface;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Executable\ExecutableManagerInterface;
use Drupal\Core\Extension\ThemeHandlerInterface;
use Drupal\Core\Form\FormStateInterface;
@ -23,6 +24,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @internal
*/
class BlockForm extends EntityForm {
use DeprecatedServicePropertyTrait;
/**
* {@inheritdoc}
*/
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The block entity.
@ -76,7 +83,7 @@ class BlockForm extends EntityForm {
/**
* Constructs a BlockForm object.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity manager.
* @param \Drupal\Core\Executable\ExecutableManagerInterface $manager
* The ConditionManager for building the visibility UI.
@ -89,8 +96,8 @@ class BlockForm extends EntityForm {
* @param \Drupal\Core\Plugin\PluginFormFactoryInterface $plugin_form_manager
* The plugin form manager.
*/
public function __construct(EntityManagerInterface $entity_manager, ExecutableManagerInterface $manager, ContextRepositoryInterface $context_repository, LanguageManagerInterface $language, ThemeHandlerInterface $theme_handler, PluginFormFactoryInterface $plugin_form_manager) {
$this->storage = $entity_manager->getStorage('block');
public function __construct(EntityTypeManagerInterface $entity_type_manager, ExecutableManagerInterface $manager, ContextRepositoryInterface $context_repository, LanguageManagerInterface $language, ThemeHandlerInterface $theme_handler, PluginFormFactoryInterface $plugin_form_manager) {
$this->storage = $entity_type_manager->getStorage('block');
$this->manager = $manager;
$this->contextRepository = $context_repository;
$this->language = $language;

View File

@ -2,10 +2,11 @@
namespace Drupal\color\Plugin\migrate\source\d7;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Extension\ThemeHandler;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\VariableMultiRow;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\State\StateInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -19,6 +20,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* )
*/
class Color extends VariableMultiRow {
use DeprecatedServicePropertyTrait;
/**
* {@inheritdoc}
*/
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The theme handler.
@ -30,8 +37,8 @@ class Color extends VariableMultiRow {
/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager, ThemeHandler $theme_handler) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityTypeManagerInterface $entity_type_manager, ThemeHandler $theme_handler) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_type_manager);
$this->themeHandler = $theme_handler;
}

View File

@ -4,7 +4,8 @@ namespace Drupal\field;
use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface;
use Drupal\Core\Config\Config;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\DeletedFieldsRepositoryInterface;
use Drupal\Core\Field\FieldConfigStorageBase;
@ -18,13 +19,19 @@ use Drupal\Component\Uuid\UuidInterface;
* Storage handler for field config.
*/
class FieldConfigStorage extends FieldConfigStorageBase {
use DeprecatedServicePropertyTrait;
/**
* The entity manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* {@inheritdoc}
*/
protected $entityManager;
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* The field type plugin manager.
@ -51,8 +58,8 @@ class FieldConfigStorage extends FieldConfigStorageBase {
* The UUID service.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager
* The field type plugin manager.
* @param \Drupal\Core\Field\DeletedFieldsRepositoryInterface $deleted_fields_repository
@ -60,9 +67,9 @@ class FieldConfigStorage extends FieldConfigStorageBase {
* @param \Drupal\Core\Cache\MemoryCache\MemoryCacheInterface $memory_cache
* The memory cache.
*/
public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, DeletedFieldsRepositoryInterface $deleted_fields_repository, MemoryCacheInterface $memory_cache) {
public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, EntityTypeManagerInterface $entity_type_manager, FieldTypePluginManagerInterface $field_type_manager, DeletedFieldsRepositoryInterface $deleted_fields_repository, MemoryCacheInterface $memory_cache) {
parent::__construct($entity_type, $config_factory, $uuid_service, $language_manager, $memory_cache);
$this->entityManager = $entity_manager;
$this->entityTypeManager = $entity_type_manager;
$this->fieldTypeManager = $field_type_manager;
$this->deletedFieldsRepository = $deleted_fields_repository;
}

View File

@ -5,8 +5,9 @@ namespace Drupal\field;
use Drupal\Component\Uuid\UuidInterface;
use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface;
use Drupal\Core\Config\Entity\ConfigEntityStorage;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\DeletedFieldsRepositoryInterface;
use Drupal\Core\Field\FieldTypePluginManagerInterface;
@ -19,6 +20,12 @@ use Drupal\Core\Extension\ModuleHandlerInterface;
* Storage handler for "field storage" configuration entities.
*/
class FieldStorageConfigStorage extends ConfigEntityStorage {
use DeprecatedServicePropertyTrait;
/**
* {@inheritdoc}
*/
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The module handler.
@ -28,11 +35,11 @@ class FieldStorageConfigStorage extends ConfigEntityStorage {
protected $moduleHandler;
/**
* The entity manager.
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityManager;
protected $entityTypeManager;
/**
* The field type plugin manager.
@ -59,8 +66,8 @@ class FieldStorageConfigStorage extends ConfigEntityStorage {
* The UUID service.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
* @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager
@ -70,9 +77,9 @@ class FieldStorageConfigStorage extends ConfigEntityStorage {
* @param \Drupal\Core\Cache\MemoryCache\MemoryCacheInterface $memory_cache
* The memory cache.
*/
public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler, FieldTypePluginManagerInterface $field_type_manager, DeletedFieldsRepositoryInterface $deleted_fields_repository, MemoryCacheInterface $memory_cache) {
public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, FieldTypePluginManagerInterface $field_type_manager, DeletedFieldsRepositoryInterface $deleted_fields_repository, MemoryCacheInterface $memory_cache) {
parent::__construct($entity_type, $config_factory, $uuid_service, $language_manager, $memory_cache);
$this->entityManager = $entity_manager;
$this->entityTypeManager = $entity_type_manager;
$this->moduleHandler = $module_handler;
$this->fieldTypeManager = $field_type_manager;
$this->deletedFieldsRepository = $deleted_fields_repository;

View File

@ -3,7 +3,8 @@
namespace Drupal\field_ui;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -13,29 +14,35 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class FieldUiPermissions implements ContainerInjectionInterface {
use StringTranslationTrait;
use DeprecatedServicePropertyTrait;
/**
* The entity manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* {@inheritdoc}
*/
protected $entityManager;
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a new FieldUiPermissions instance.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(EntityManagerInterface $entity_manager) {
$this->entityManager = $entity_manager;
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container->get('entity.manager'));
return new static($container->get('entity_type.manager'));
}
/**
@ -46,7 +53,7 @@ class FieldUiPermissions implements ContainerInjectionInterface {
public function fieldPermissions() {
$permissions = [];
foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) {
foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type->get('field_ui_base_route')) {
// Create a permission for each fieldable entity to manage
// the fields and the display.

View File

@ -3,7 +3,8 @@
namespace Drupal\field_ui\Plugin\Derivative;
use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
use Drupal\Core\Routing\RouteProviderInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
@ -15,25 +16,31 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class FieldUiLocalAction extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
use DeprecatedServicePropertyTrait;
/**
* The entity manager
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* {@inheritdoc}
*/
protected $entityManager;
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a FieldUiLocalAction object.
*
* @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
* The route provider to load routes by name.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_manager
* The entity type manager.
*/
public function __construct(RouteProviderInterface $route_provider, EntityManagerInterface $entity_manager) {
public function __construct(RouteProviderInterface $route_provider, EntityTypeManagerInterface $entity_manager) {
$this->routeProvider = $route_provider;
$this->entityManager = $entity_manager;
$this->entityTypeManager = $entity_manager;
}
/**
@ -42,7 +49,7 @@ class FieldUiLocalAction extends DeriverBase implements ContainerDeriverInterfac
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static(
$container->get('router.route_provider'),
$container->get('entity.manager')
$container->get('entity_type.manager')
);
}
@ -52,7 +59,7 @@ class FieldUiLocalAction extends DeriverBase implements ContainerDeriverInterfac
public function getDerivativeDefinitions($base_plugin_definition) {
$this->derivatives = [];
foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) {
foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type->get('field_ui_base_route')) {
$this->derivatives["field_storage_config_add_$entity_type_id"] = [
'route_name' => "field_ui.field_storage_config_add_$entity_type_id",

View File

@ -2,7 +2,8 @@
namespace Drupal\file\Plugin\views\argument;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\views\Plugin\views\argument\NumericArgument;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -15,13 +16,19 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @ViewsArgument("file_fid")
*/
class Fid extends NumericArgument implements ContainerFactoryPluginInterface {
use DeprecatedServicePropertyTrait;
/**
* The entity manager service
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* {@inheritdoc}
*/
protected $entityManager;
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a Drupal\file\Plugin\views\argument\Fid object.
@ -32,12 +39,12 @@ class Fid extends NumericArgument implements ContainerFactoryPluginInterface {
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityManager = $entity_manager;
$this->entityTypeManager = $entity_type_manager;
}
/**
@ -48,7 +55,7 @@ class Fid extends NumericArgument implements ContainerFactoryPluginInterface {
$configuration,
$plugin_id,
$plugin_definition,
$container->get('entity.manager')
$container->get('entity_type.manager')
);
}
@ -56,7 +63,7 @@ class Fid extends NumericArgument implements ContainerFactoryPluginInterface {
* Override the behavior of titleQuery(). Get the filenames.
*/
public function titleQuery() {
$storage = $this->entityManager->getStorage('file');
$storage = $this->entityTypeManager->getStorage('file');
$fids = $storage->getQuery()
->condition('fid', $this->value, 'IN')
->execute();

View File

@ -3,7 +3,8 @@
namespace Drupal\filter;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -13,22 +14,28 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class FilterPermissions implements ContainerInjectionInterface {
use StringTranslationTrait;
use DeprecatedServicePropertyTrait;
/**
* The entity manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* {@inheritdoc}
*/
protected $entityManager;
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a new FilterPermissions instance.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(EntityManagerInterface $entity_manager) {
$this->entityManager = $entity_manager;
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**
@ -48,7 +55,7 @@ class FilterPermissions implements ContainerInjectionInterface {
// Generate permissions for each text format. Warn the administrator that any
// of them are potentially unsafe.
/** @var \Drupal\filter\FilterFormatInterface[] $formats */
$formats = $this->entityManager->getStorage('filter_format')->loadByProperties(['status' => TRUE]);
$formats = $this->entityTypeManager->getStorage('filter_format')->loadByProperties(['status' => TRUE]);
uasort($formats, 'Drupal\Core\Config\Entity\ConfigEntityBase::sort');
foreach ($formats as $format) {
if ($permission = $format->getPermissionName()) {

View File

@ -2,8 +2,9 @@
namespace Drupal\language\Plugin\LanguageNegotiation;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\PathProcessor\OutboundPathProcessorInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Render\BubbleableMetadata;
@ -27,6 +28,12 @@ use Symfony\Component\Routing\Route;
* )
*/
class LanguageNegotiationContentEntity extends LanguageNegotiationMethodBase implements OutboundPathProcessorInterface, LanguageSwitcherInterface, ContainerFactoryPluginInterface {
use DeprecatedServicePropertyTrait;
/**
* {@inheritdoc}
*/
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The language negotiation method ID.
@ -62,20 +69,20 @@ class LanguageNegotiationContentEntity extends LanguageNegotiationMethodBase imp
protected $paths;
/**
* The entity manager.
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityManager;
protected $entityTypeManager;
/**
* Constructs a new LanguageNegotiationContentEntity instance.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(EntityManagerInterface $entity_manager) {
$this->entityManager = $entity_manager;
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
$this->paths = new \SplObjectStorage();
}
@ -261,7 +268,7 @@ class LanguageNegotiationContentEntity extends LanguageNegotiationMethodBase imp
protected function getContentEntityPaths() {
if (!isset($this->contentEntityPaths)) {
$this->contentEntityPaths = [];
$entity_types = $this->entityManager->getDefinitions();
$entity_types = $this->entityTypeManager->getDefinitions();
foreach ($entity_types as $entity_type_id => $entity_type) {
if ($entity_type->entityClassImplements(ContentEntityInterface::class)) {
$entity_paths = array_fill_keys($entity_type->getLinkTemplates(), $entity_type_id);

View File

@ -3,7 +3,8 @@
namespace Drupal\menu_link_content\Plugin\Deriver;
use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Menu\MenuLinkManagerInterface;
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -15,13 +16,19 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* compared to entity referenced ones.
*/
class MenuLinkContentDeriver extends DeriverBase implements ContainerDeriverInterface {
use DeprecatedServicePropertyTrait;
/**
* The entity manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* {@inheritdoc}
*/
protected $entityManager;
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* The menu link manager.
@ -33,13 +40,13 @@ class MenuLinkContentDeriver extends DeriverBase implements ContainerDeriverInte
/**
* Constructs a MenuLinkContentDeriver instance.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager
* The menu link manager.
*/
public function __construct(EntityManagerInterface $entity_manager, MenuLinkManagerInterface $menu_link_manager) {
$this->entityManager = $entity_manager;
public function __construct(EntityTypeManagerInterface $entity_type_manager, MenuLinkManagerInterface $menu_link_manager) {
$this->entityTypeManager = $entity_type_manager;
$this->menuLinkManager = $menu_link_manager;
}
@ -48,7 +55,7 @@ class MenuLinkContentDeriver extends DeriverBase implements ContainerDeriverInte
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static(
$container->get('entity.manager'),
$container->get('entity_type.manager'),
$container->get('plugin.manager.menu.link')
);
}
@ -58,11 +65,11 @@ class MenuLinkContentDeriver extends DeriverBase implements ContainerDeriverInte
*/
public function getDerivativeDefinitions($base_plugin_definition) {
// Get all custom menu links which should be rediscovered.
$entity_ids = $this->entityManager->getStorage('menu_link_content')->getQuery()
$entity_ids = $this->entityTypeManager->getStorage('menu_link_content')->getQuery()
->condition('rediscover', TRUE)
->execute();
$plugin_definitions = [];
$menu_link_content_entities = $this->entityManager->getStorage('menu_link_content')->loadMultiple($entity_ids);
$menu_link_content_entities = $this->entityTypeManager->getStorage('menu_link_content')->loadMultiple($entity_ids);
/** @var \Drupal\menu_link_content\MenuLinkContentInterface $menu_link_content */
foreach ($menu_link_content_entities as $menu_link_content) {
$plugin_definitions[$menu_link_content->uuid()] = $menu_link_content->getPluginDefinition();

View File

@ -3,8 +3,9 @@
namespace Drupal\migrate_drupal\Plugin\migrate\source;
use Drupal\Component\Plugin\DependentPluginInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\DependencyTrait;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\State\StateInterface;
use Drupal\migrate\Plugin\MigrationInterface;
@ -30,6 +31,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
abstract class DrupalSqlBase extends SqlBase implements ContainerFactoryPluginInterface, DependentPluginInterface {
use DependencyTrait;
use DeprecatedServicePropertyTrait;
/**
* {@inheritdoc}
*/
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The contents of the system table.
@ -46,18 +53,18 @@ abstract class DrupalSqlBase extends SqlBase implements ContainerFactoryPluginIn
protected $requirements = TRUE;
/**
* The entity manager.
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityManager;
protected $entityTypeManager;
/**
* {@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) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state);
$this->entityManager = $entity_manager;
$this->entityTypeManager = $entity_type_manager;
}
/**
@ -176,7 +183,7 @@ abstract class DrupalSqlBase extends SqlBase implements ContainerFactoryPluginIn
public function calculateDependencies() {
// Generic handling for Drupal source plugin constants.
if (isset($this->configuration['constants']['entity_type'])) {
$this->addDependency('module', $this->entityManager->getDefinition($this->configuration['constants']['entity_type'])->getProvider());
$this->addDependency('module', $this->entityTypeManager->getDefinition($this->configuration['constants']['entity_type'])->getProvider());
}
if (isset($this->configuration['constants']['module'])) {
$this->addDependency('module', $this->configuration['constants']['module']);

View File

@ -3,11 +3,12 @@
namespace Drupal\migrate_drupal\Plugin\migrate\source;
use Drupal\Component\Plugin\DependentPluginInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\DependencyTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Plugin\migrate\source\EmptySource as BaseEmptySource;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
/**
@ -21,20 +22,26 @@ use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
class EmptySource extends BaseEmptySource implements ContainerFactoryPluginInterface, DependentPluginInterface {
use DependencyTrait;
/**
* The entity manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
*/
protected $entityManager;
use DeprecatedServicePropertyTrait;
/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityManagerInterface $entity_manager) {
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityTypeManagerInterface $entity_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration);
$this->entityManager = $entity_manager;
$this->entityTypeManager = $entity_manager;
}
/**
@ -46,7 +53,7 @@ class EmptySource extends BaseEmptySource implements ContainerFactoryPluginInter
$plugin_id,
$plugin_definition,
$migration,
$container->get('entity.manager')
$container->get('entity_type.manager')
);
}
@ -56,7 +63,7 @@ class EmptySource extends BaseEmptySource implements ContainerFactoryPluginInter
public function calculateDependencies() {
// The empty source plugin supports the entity_type constant.
if (isset($this->configuration['constants']['entity_type'])) {
$this->addDependency('module', $this->entityManager->getDefinition($this->configuration['constants']['entity_type'])->getProvider());
$this->addDependency('module', $this->entityTypeManager->getDefinition($this->configuration['constants']['entity_type'])->getProvider());
}
return $this->dependencies;
}

View File

@ -2,7 +2,7 @@
namespace Drupal\migrate_drupal\Plugin\migrate\source;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\State\StateInterface;
use Drupal\migrate\Plugin\MigrationInterface;
@ -29,8 +29,8 @@ class Variable extends DrupalSqlBase {
/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_type_manager);
$this->variables = $this->configuration['variables'];
}

View File

@ -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;
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
@ -27,8 +27,8 @@ class VariableTranslation extends DrupalSqlBase {
/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_type_manager);
$this->variables = $this->configuration['variables'];
}

View File

@ -2,7 +2,7 @@
namespace Drupal\migrate_drupal\Plugin\migrate\source\d7;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\State\StateInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
@ -26,8 +26,8 @@ class VariableTranslation extends DrupalSqlBase {
/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_type_manager);
$this->variables = $this->configuration['variables'];
}

View File

@ -9,7 +9,8 @@ use Drupal\Core\Database\Connection;
use Drupal\Core\Database\Database;
use Drupal\Core\Database\Query\SelectExtender;
use Drupal\Core\Database\StatementInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageInterface;
@ -34,6 +35,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* )
*/
class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInterface, SearchIndexingInterface {
use DeprecatedServicePropertyTrait;
/**
* {@inheritdoc}
*/
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The current database connection.
@ -50,11 +57,11 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter
protected $databaseReplica;
/**
* An entity manager object.
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityManager;
protected $entityTypeManager;
/**
* A module manager object.
@ -139,7 +146,7 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter
$plugin_id,
$plugin_definition,
$container->get('database'),
$container->get('entity.manager'),
$container->get('entity_type.manager'),
$container->get('module_handler'),
$container->get('config.factory')->get('search.settings'),
$container->get('language_manager'),
@ -161,8 +168,8 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter
* The plugin implementation definition.
* @param \Drupal\Core\Database\Connection $database
* The current database connection.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* An entity manager object.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* A module manager object.
* @param \Drupal\Core\Config\Config $search_settings
@ -178,10 +185,10 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter
* @param \Drupal\Core\Database\Connection|null $database_replica
* (Optional) the replica database connection.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, Connection $database, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler, Config $search_settings, LanguageManagerInterface $language_manager, RendererInterface $renderer, MessengerInterface $messenger, AccountInterface $account = NULL, Connection $database_replica = NULL) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, Connection $database, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, Config $search_settings, LanguageManagerInterface $language_manager, RendererInterface $renderer, MessengerInterface $messenger, AccountInterface $account = NULL, Connection $database_replica = NULL) {
$this->database = $database;
$this->databaseReplica = $database_replica ?: $database;
$this->entityManager = $entity_manager;
$this->entityTypeManager = $entity_type_manager;
$this->moduleHandler = $module_handler;
$this->searchSettings = $search_settings;
$this->languageManager = $language_manager;
@ -339,8 +346,8 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter
protected function prepareResults(StatementInterface $found) {
$results = [];
$node_storage = $this->entityManager->getStorage('node');
$node_render = $this->entityManager->getViewBuilder('node');
$node_storage = $this->entityTypeManager->getStorage('node');
$node_render = $this->entityTypeManager->getViewBuilder('node');
$keys = $this->keywords;
foreach ($found as $item) {
@ -350,7 +357,7 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter
$build = $node_render->view($node, 'search_result', $item->langcode);
/** @var \Drupal\node\NodeTypeInterface $type*/
$type = $this->entityManager->getStorage('node_type')->load($node->bundle());
$type = $this->entityTypeManager->getStorage('node_type')->load($node->bundle());
unset($build['#theme']);
$build['#pre_render'][] = [$this, 'removeSubmittedInfo'];
@ -470,7 +477,7 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter
return;
}
$node_storage = $this->entityManager->getStorage('node');
$node_storage = $this->entityTypeManager->getStorage('node');
foreach ($node_storage->loadMultiple($nids) as $node) {
$this->indexNode($node);
}
@ -484,7 +491,7 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter
*/
protected function indexNode(NodeInterface $node) {
$languages = $node->getTranslationLanguages();
$node_render = $this->entityManager->getViewBuilder('node');
$node_render = $this->entityTypeManager->getViewBuilder('node');
foreach ($languages as $language) {
$node = $node->getTranslation($language->getId());

View File

@ -3,7 +3,7 @@
namespace Drupal\node\Plugin\migrate\source\d6;
use Drupal\Core\Database\Query\SelectInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandler;
use Drupal\Core\State\StateInterface;
use Drupal\migrate\Plugin\MigrationInterface;
@ -51,8 +51,8 @@ class Node extends DrupalSqlBase {
/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager, ModuleHandler $module_handler) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityTypeManagerInterface $entity_type_manager, ModuleHandler $module_handler) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_type_manager);
$this->moduleHandler = $module_handler;
}

View File

@ -6,7 +6,7 @@ use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
use Drupal\Core\Database\Query\SelectInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandler;
use Drupal\Core\State\StateInterface;
use Drupal\migrate\Plugin\MigrationInterface;
@ -31,8 +31,8 @@ class Node extends FieldableEntity {
/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_type_manager);
$this->moduleHandler = $module_handler;
}

View File

@ -2,7 +2,8 @@
namespace Drupal\rest\Plugin\Deriver;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -12,6 +13,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @see \Drupal\rest\Plugin\rest\resource\EntityResource
*/
class EntityDeriver implements ContainerDeriverInterface {
use DeprecatedServicePropertyTrait;
/**
* {@inheritdoc}
*/
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* List of derivative definitions.
@ -21,20 +28,20 @@ class EntityDeriver implements ContainerDeriverInterface {
protected $derivatives;
/**
* The entity manager.
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityManager;
protected $entityTypeManager;
/**
* Constructs an EntityDeriver object.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(EntityManagerInterface $entity_manager) {
$this->entityManager = $entity_manager;
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**
@ -64,7 +71,7 @@ class EntityDeriver implements ContainerDeriverInterface {
public function getDerivativeDefinitions($base_plugin_definition) {
if (!isset($this->derivatives)) {
// Add in the default plugin configuration and the resource type.
foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) {
foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type->isInternal()) {
continue;
}

View File

@ -3,7 +3,8 @@
namespace Drupal\taxonomy;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\taxonomy\Entity\Vocabulary;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -16,22 +17,28 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class TaxonomyPermissions implements ContainerInjectionInterface {
use StringTranslationTrait;
use DeprecatedServicePropertyTrait;
/**
* The entity manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* {@inheritdoc}
*/
protected $entityManager;
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a TaxonomyPermissions instance.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(EntityManagerInterface $entity_manager) {
$this->entityManager = $entity_manager;
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**

View File

@ -2,7 +2,8 @@
namespace Drupal\user\Form;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Messenger\MessengerInterface;
@ -17,6 +18,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @internal
*/
class UserMultipleCancelConfirm extends ConfirmFormBase {
use DeprecatedServicePropertyTrait;
/**
* {@inheritdoc}
*/
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The temp store factory.
@ -33,11 +40,11 @@ class UserMultipleCancelConfirm extends ConfirmFormBase {
protected $userStorage;
/**
* The entity manager.
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityManager;
protected $entityTypeManager;
/**
* Constructs a new UserMultipleCancelConfirm.
@ -46,13 +53,13 @@ class UserMultipleCancelConfirm extends ConfirmFormBase {
* The temp store factory.
* @param \Drupal\user\UserStorageInterface $user_storage
* The user storage.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(PrivateTempStoreFactory $temp_store_factory, UserStorageInterface $user_storage, EntityManagerInterface $entity_manager) {
public function __construct(PrivateTempStoreFactory $temp_store_factory, UserStorageInterface $user_storage, EntityTypeManagerInterface $entity_type_manager) {
$this->tempStoreFactory = $temp_store_factory;
$this->userStorage = $user_storage;
$this->entityManager = $entity_manager;
$this->entityTypeManager = $entity_type_manager;
}
/**
@ -61,8 +68,8 @@ class UserMultipleCancelConfirm extends ConfirmFormBase {
public static function create(ContainerInterface $container) {
return new static(
$container->get('tempstore.private'),
$container->get('entity.manager')->getStorage('user'),
$container->get('entity.manager')
$container->get('entity_type.manager')->getStorage('user'),
$container->get('entity_type.manager')
);
}
@ -207,7 +214,7 @@ class UserMultipleCancelConfirm extends ConfirmFormBase {
// The $user global is not a complete user entity, so load the full
// entity.
$account = $this->userStorage->load($uid);
$admin_form = $this->entityManager->getFormObject('user', 'cancel');
$admin_form = $this->entityTypeManager->getFormObject('user', 'cancel');
$admin_form->setEntity($account);
// Calling this directly required to init form object with $account.
$admin_form->buildForm($admin_form_mock, $admin_form_state);

View File

@ -4,7 +4,8 @@ namespace Drupal\user\Plugin\Search;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Access\AccessibleInterface;
@ -20,6 +21,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* )
*/
class UserSearch extends SearchPluginBase implements AccessibleInterface {
use DeprecatedServicePropertyTrait;
/**
* {@inheritdoc}
*/
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The database connection.
@ -29,11 +36,11 @@ class UserSearch extends SearchPluginBase implements AccessibleInterface {
protected $database;
/**
* The entity manager.
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityManager;
protected $entityTypeManager;
/**
* The module handler.
@ -55,7 +62,7 @@ class UserSearch extends SearchPluginBase implements AccessibleInterface {
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$container->get('database'),
$container->get('entity.manager'),
$container->get('entity_type.manager'),
$container->get('module_handler'),
$container->get('current_user'),
$configuration,
@ -69,8 +76,8 @@ class UserSearch extends SearchPluginBase implements AccessibleInterface {
*
* @param \Drupal\Core\Database\Connection $database
* The database connection.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
* @param \Drupal\Core\Session\AccountInterface $current_user
@ -82,9 +89,9 @@ class UserSearch extends SearchPluginBase implements AccessibleInterface {
* @param mixed $plugin_definition
* The plugin implementation definition.
*/
public function __construct(Connection $database, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler, AccountInterface $current_user, array $configuration, $plugin_id, $plugin_definition) {
public function __construct(Connection $database, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, AccountInterface $current_user, array $configuration, $plugin_id, $plugin_definition) {
$this->database = $database;
$this->entityManager = $entity_manager;
$this->entityTypeManager = $entity_type_manager;
$this->moduleHandler = $module_handler;
$this->currentUser = $current_user;
parent::__construct($configuration, $plugin_id, $plugin_definition);
@ -141,7 +148,7 @@ class UserSearch extends SearchPluginBase implements AccessibleInterface {
->limit(15)
->execute()
->fetchCol();
$accounts = $this->entityManager->getStorage('user')->loadMultiple($uids);
$accounts = $this->entityTypeManager->getStorage('user')->loadMultiple($uids);
foreach ($accounts as $account) {
$result = [

View File

@ -2,7 +2,7 @@
namespace Drupal\user\Plugin\views\argument;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\views\Plugin\views\argument\ManyToOne;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -31,13 +31,13 @@ class RolesRid extends ManyToOne {
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->roleStorage = $entity_manager->getStorage('user_role');
$this->roleStorage = $entity_type_manager->getStorage('user_role');
}
/**

View File

@ -2,7 +2,7 @@
namespace Drupal\user\Plugin\views\field;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
@ -43,13 +43,13 @@ class Permissions extends PrerenderList {
* The plugin implementation definition.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, ModuleHandlerInterface $module_handler, EntityManagerInterface $entity_manager) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, ModuleHandlerInterface $module_handler, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->roleStorage = $entity_manager->getStorage('user_role');
$this->roleStorage = $entity_type_manager->getStorage('user_role');
$this->moduleHandler = $module_handler;
}

View File

@ -3,7 +3,8 @@
namespace Drupal\views\Plugin\Derivative;
use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\TranslationInterface;
@ -18,6 +19,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*/
class ViewsEntityArgumentValidator extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
use DeprecatedServicePropertyTrait;
/**
* {@inheritdoc}
*/
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The base plugin ID this derivative is for.
@ -27,11 +34,11 @@ class ViewsEntityArgumentValidator extends DeriverBase implements ContainerDeriv
protected $basePluginId;
/**
* The entity manager.
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityManager;
protected $entityTypeManager;
/**
* List of derivative definitions.
@ -45,14 +52,14 @@ class ViewsEntityArgumentValidator extends DeriverBase implements ContainerDeriv
*
* @param string $base_plugin_id
* The base plugin ID.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The string translation.
*/
public function __construct($base_plugin_id, EntityManagerInterface $entity_manager, TranslationInterface $string_translation) {
public function __construct($base_plugin_id, EntityTypeManagerInterface $entity_type_manager, TranslationInterface $string_translation) {
$this->basePluginId = $base_plugin_id;
$this->entityManager = $entity_manager;
$this->entityTypeManager = $entity_type_manager;
$this->stringTranslation = $string_translation;
}
@ -62,7 +69,7 @@ class ViewsEntityArgumentValidator extends DeriverBase implements ContainerDeriv
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('string_translation')
);
}
@ -71,7 +78,7 @@ class ViewsEntityArgumentValidator extends DeriverBase implements ContainerDeriv
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$entity_types = $this->entityManager->getDefinitions();
$entity_types = $this->entityTypeManager->getDefinitions();
$this->derivatives = [];
foreach ($entity_types as $entity_type_id => $entity_type) {
$this->derivatives[$entity_type_id] = [

View File

@ -2,7 +2,8 @@
namespace Drupal\views\Plugin\Derivative;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
use Drupal\views\ViewsData;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -15,6 +16,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @see \Drupal\views\Plugin\views\row\EntityRow
*/
class ViewsEntityRow implements ContainerDeriverInterface {
use DeprecatedServicePropertyTrait;
/**
* {@inheritdoc}
*/
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* Stores all entity row plugin information.
@ -31,11 +38,11 @@ class ViewsEntityRow implements ContainerDeriverInterface {
protected $basePluginId;
/**
* The entity manager.
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityManager;
protected $entityTypeManager;
/**
* The views data service.
@ -49,14 +56,14 @@ class ViewsEntityRow implements ContainerDeriverInterface {
*
* @param string $base_plugin_id
* The base plugin ID.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\views\ViewsData $views_data
* The views data service.
*/
public function __construct($base_plugin_id, EntityManagerInterface $entity_manager, ViewsData $views_data) {
public function __construct($base_plugin_id, EntityTypeManagerInterface $entity_type_manager, ViewsData $views_data) {
$this->basePluginId = $base_plugin_id;
$this->entityManager = $entity_manager;
$this->entityTypeManager = $entity_type_manager;
$this->viewsData = $views_data;
}
@ -86,9 +93,9 @@ class ViewsEntityRow implements ContainerDeriverInterface {
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) {
foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) {
// Just add support for entity types which have a views integration.
if (($base_table = $entity_type->getBaseTable()) && $this->viewsData->get($base_table) && $this->entityManager->hasHandler($entity_type_id, 'view_builder')) {
if (($base_table = $entity_type->getBaseTable()) && $this->viewsData->get($base_table) && $this->entityTypeManager->hasHandler($entity_type_id, 'view_builder')) {
$this->derivatives[$entity_type_id] = [
'id' => 'entity:' . $entity_type_id,
'provider' => 'views',

View File

@ -2,8 +2,9 @@
namespace Drupal\views\Plugin\Menu;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Menu\MenuLinkBase;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\views\ViewExecutableFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -14,6 +15,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @see \Drupal\views\Plugin\Derivative\ViewsMenuLink
*/
class ViewsMenuLink extends MenuLinkBase implements ContainerFactoryPluginInterface {
use DeprecatedServicePropertyTrait;
/**
* {@inheritdoc}
*/
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* {@inheritdoc}
@ -29,11 +36,11 @@ class ViewsMenuLink extends MenuLinkBase implements ContainerFactoryPluginInterf
];
/**
* The entity manager.
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityManager;
protected $entityTypeManager;
/**
* The view executable factory.
@ -58,15 +65,15 @@ class ViewsMenuLink extends MenuLinkBase implements ContainerFactoryPluginInterf
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\views\ViewExecutableFactory $view_executable_factory
* The view executable factory
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, ViewExecutableFactory $view_executable_factory) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, ViewExecutableFactory $view_executable_factory) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityManager = $entity_manager;
$this->entityTypeManager = $entity_type_manager;
$this->viewExecutableFactory = $view_executable_factory;
}
@ -94,7 +101,7 @@ class ViewsMenuLink extends MenuLinkBase implements ContainerFactoryPluginInterf
$metadata = $this->getMetaData();
$view_id = $metadata['view_id'];
$display_id = $metadata['display_id'];
$view_entity = $this->entityManager->getStorage('view')->load($view_id);
$view_entity = $this->entityTypeManager->getStorage('view')->load($view_id);
$view = $this->viewExecutableFactory->get($view_entity);
$view->setDisplay($display_id);
$view->initDisplay();

View File

@ -4,7 +4,8 @@ namespace Drupal\views\Plugin\views\display;
use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface;
use Drupal\Core\Block\BlockManagerInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\Block\ViewsBlock;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -29,6 +30,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @see \Drupal\views\Plugin\Derivative\ViewsBlock
*/
class Block extends DisplayPluginBase {
use DeprecatedServicePropertyTrait;
/**
* {@inheritdoc}
*/
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* Whether the display allows attachments.
@ -38,11 +45,11 @@ class Block extends DisplayPluginBase {
protected $usesAttachments = TRUE;
/**
* The entity manager.
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityManager;
protected $entityTypeManager;
/**
* The block manager.
@ -60,15 +67,15 @@ class Block extends DisplayPluginBase {
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity manager.
* @param \Drupal\Core\Block\BlockManagerInterface $block_manager
* The block manager.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, BlockManagerInterface $block_manager) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, BlockManagerInterface $block_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityManager = $entity_manager;
$this->entityTypeManager = $entity_type_manager;
$this->blockManager = $block_manager;
}
@ -371,9 +378,9 @@ class Block extends DisplayPluginBase {
public function remove() {
parent::remove();
if ($this->entityManager->hasDefinition('block')) {
if ($this->entityTypeManager->hasDefinition('block')) {
$plugin_id = 'views_block:' . $this->view->storage->id() . '-' . $this->display['id'];
foreach ($this->entityManager->getStorage('block')->loadByProperties(['plugin' => $plugin_id]) as $block) {
foreach ($this->entityTypeManager->getStorage('block')->loadByProperties(['plugin' => $plugin_id]) as $block) {
$block->delete();
}
}

View File

@ -2,7 +2,8 @@
namespace Drupal\views\Plugin\views\filter;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
@ -16,6 +17,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @ViewsFilter("bundle")
*/
class Bundle extends InOperator {
use DeprecatedServicePropertyTrait;
/**
* {@inheritdoc}
*/
protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
/**
* The entity type for the filter.
@ -32,11 +39,11 @@ class Bundle extends InOperator {
protected $entityType;
/**
* The entity manager.
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityManager;
protected $entityTypeManager;
/**
* The bundle info service.
@ -54,15 +61,15 @@ class Bundle extends InOperator {
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $bundle_info_service
* The bundle info service.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, EntityTypeBundleInfoInterface $bundle_info_service) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleInfoInterface $bundle_info_service) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityManager = $entity_manager;
$this->entityTypeManager = $entity_type_manager;
$this->bundleInfoService = $bundle_info_service;
}
@ -86,7 +93,7 @@ class Bundle extends InOperator {
parent::init($view, $display, $options);
$this->entityTypeId = $this->getEntityType();
$this->entityType = \Drupal::entityManager()->getDefinition($this->entityTypeId);
$this->entityType = \Drupal::entityTypeManager()->getDefinition($this->entityTypeId);
$this->real_field = $this->entityType->getKey('bundle');
}
@ -126,7 +133,7 @@ class Bundle extends InOperator {
$dependencies = parent::calculateDependencies();
$bundle_entity_type = $this->entityType->getBundleEntityType();
$bundle_entity_storage = $this->entityManager->getStorage($bundle_entity_type);
$bundle_entity_storage = $this->entityTypeManager->getStorage($bundle_entity_type);
foreach (array_keys($this->value) as $bundle) {
if ($bundle_entity = $bundle_entity_storage->load($bundle)) {