Unverified Commit 408c540c authored by alexpott's avatar alexpott
Browse files

Issue #2886622 by Berdir, martin107, Mile23, tim.plunkett, mikelutz,...

Issue #2886622 by Berdir, martin107, Mile23, tim.plunkett, mikelutz, jonathan1055: Deprecate all EntityManager methods with E_USER_DEPRECATED
parent d397f60c
......@@ -47,7 +47,7 @@ public static function create(ContainerInterface $container, array $configuratio
$configuration,
$plugin_id,
$plugin_definition,
$container->get('entity.manager')->getStorage('comment')
$container->get('entity_type.manager')->getStorage('comment')
);
}
......
......@@ -42,7 +42,7 @@ public function __construct(UserStorageInterface $user_storage) {
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container->get('entity.manager')->getStorage('user'));
return new static($container->get('entity_type.manager')->getStorage('user'));
}
/**
......
......@@ -39,7 +39,7 @@ protected function setUp() {
* Tests the node comment statistics.
*/
public function testCommentNodeCommentStatistics() {
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
// Set comments to have subject and preview disabled.
$this->drupalLogin($this->adminUser);
$this->setCommentPreview(DRUPAL_DISABLED);
......
......@@ -48,9 +48,9 @@ protected function setUp($import_test_views = TRUE) {
$this->installEntitySchema('comment');
$this->installConfig(['user']);
$entity_manager = $this->container->get('entity.manager');
$this->commentStorage = $entity_manager->getStorage('comment');
$this->userStorage = $entity_manager->getStorage('user');
$entity_type_manager = $this->container->get('entity_type.manager');
$this->commentStorage = $entity_type_manager->getStorage('comment');
$this->userStorage = $entity_type_manager->getStorage('user');
// Insert a row for the anonymous user.
$this->userStorage
......
......@@ -33,7 +33,7 @@ public function testConfigDependencyDeleteFormTrait() {
$this->drupalLogin($this->drupalCreateUser(['administer site configuration']));
/** @var \Drupal\Core\Config\Entity\ConfigEntityStorage $storage */
$storage = $this->container->get('entity.manager')->getStorage('config_test');
$storage = $this->container->get('entity_type.manager')->getStorage('config_test');
// Entity1 will be deleted by the test.
$entity1 = $storage->create(
[
......
......@@ -26,7 +26,7 @@ public function testFormsWithOverrides() {
$overridden_label = 'Overridden label';
$edited_label = 'Edited label';
$config_test_storage = $this->container->get('entity.manager')->getStorage('config_test');
$config_test_storage = $this->container->get('entity_type.manager')->getStorage('config_test');
// Set up an override.
$settings['config']['config_test.dynamic.dotted.default']['label'] = (object) [
......
......@@ -121,7 +121,7 @@ public function testList() {
// Test that config entities that do not support status, do not have
// enable/disable operations.
$controller = $this->container->get('entity.manager')
$controller = $this->container->get('entity_type.manager')
->getListBuilder('config_test_no_status');
$list = $controller->load();
......
......@@ -148,7 +148,7 @@ public function testListingPageWithOverrides() {
$original_label = 'Default';
$overridden_label = 'Overridden label';
$config_test_storage = $this->container->get('entity.manager')->getStorage('config_test');
$config_test_storage = $this->container->get('entity_type.manager')->getStorage('config_test');
// Set up an override.
$settings['config']['config_test.dynamic.dotted.default']['label'] = (object) [
......
......@@ -22,11 +22,11 @@ class ConfigEntityMapperTest extends UnitTestCase {
protected $configEntityMapper;
/**
* The entity manager used for testing.
* The entity type manager used for testing.
*
* @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $entityManager;
protected $entityTypeManager;
/**
* The entity instance used for testing.
......@@ -57,7 +57,7 @@ class ConfigEntityMapperTest extends UnitTestCase {
protected $eventDispatcher;
protected function setUp() {
$this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
$this->entityTypeManager = $this->getMock('Drupal\Core\Entity\EntityTypeManagerInterface');
$this->entity = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityInterface');
......@@ -97,7 +97,7 @@ protected function setUp() {
$this->getMock('Drupal\config_translation\ConfigMapperManagerInterface'),
$this->routeProvider,
$this->getStringTranslationStub(),
$this->entityManager,
$this->entityTypeManager,
$this->languageManager,
$this->eventDispatcher
);
......@@ -118,7 +118,7 @@ public function testEntityGetterAndSetter() {
->expects($this->any())
->method('getConfigPrefix')
->will($this->returnValue('config_prefix'));
$this->entityManager
$this->entityTypeManager
->expects($this->once())
->method('getDefinition')
->with('configurable_language')
......@@ -147,7 +147,7 @@ public function testEntityGetterAndSetter() {
*/
public function testGetOverviewRouteParameters() {
$entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
$this->entityManager
$this->entityTypeManager
->expects($this->once())
->method('getDefinition')
->with('configurable_language')
......@@ -181,7 +181,7 @@ public function testGetTypeName() {
$entity_type->expects($this->once())
->method('getLabel')
->will($this->returnValue('test'));
$this->entityManager
$this->entityTypeManager
->expects($this->once())
->method('getDefinition')
->with('configurable_language')
......@@ -199,7 +199,7 @@ public function testGetTypeLabel() {
$entity_type->expects($this->once())
->method('getLabel')
->will($this->returnValue('test'));
$this->entityManager
$this->entityTypeManager
->expects($this->once())
->method('getDefinition')
->with('configurable_language')
......
......@@ -29,11 +29,11 @@ class ConfigFieldMapperTest extends UnitTestCase {
protected $entity;
/**
* The entity manager used for testing.
* The entity type manager used for testing.
*
* @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $entityManager;
protected $entityTypeManager;
/**
* The mocked event dispatcher.
......@@ -46,7 +46,7 @@ class ConfigFieldMapperTest extends UnitTestCase {
* {@inheritdoc}
*/
protected function setUp() {
$this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
$this->entityTypeManager = $this->getMock('Drupal\Core\Entity\EntityTypeManagerInterface');
$this->entity = $this->getMock('Drupal\field\FieldConfigInterface');
$definition = [
......@@ -72,7 +72,7 @@ protected function setUp() {
$this->getMock('Drupal\config_translation\ConfigMapperManagerInterface'),
$this->getMock('Drupal\Core\Routing\RouteProviderInterface'),
$this->getStringTranslationStub(),
$this->entityManager,
$this->entityTypeManager,
$this->getMock('Drupal\Core\Language\LanguageManagerInterface'),
$this->eventDispatcher
);
......@@ -90,7 +90,7 @@ public function testSetEntity() {
->method('getConfigPrefix')
->will($this->returnValue('config_prefix'));
$this->entityManager
$this->entityTypeManager
->expects($this->any())
->method('getDefinition')
->will($this->returnValue($entity_type));
......
......@@ -34,7 +34,7 @@ protected function setUp() {
* Test some of the methods.
*/
public function testMessageMethods() {
$message_storage = $this->container->get('entity.manager')->getStorage('contact_message');
$message_storage = $this->container->get('entity_type.manager')->getStorage('contact_message');
$message = $message_storage->create(['contact_form' => 'feedback']);
// Check for empty values first.
......
......@@ -25,7 +25,7 @@ class ContentTranslationPermissions implements ContainerInjectionInterface {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
......
......@@ -228,7 +228,7 @@ protected function createEntity($values, $langcode, $bundle_name = NULL) {
if ($bundle_key = $entity_type->getKey('bundle')) {
$entity_values[$bundle_key] = $bundle_name ?: $this->bundle;
}
$controller = $this->container->get('entity.manager')->getStorage($this->entityTypeId);
$controller = $this->container->get('entity_type.manager')->getStorage($this->entityTypeId);
if (!($controller instanceof SqlContentEntityStorage)) {
foreach ($values as $property => $value) {
if (is_array($value)) {
......
......@@ -285,14 +285,4 @@ public function testNonTranslatableTranslationSettingsUI() {
$this->assertNoField('settings[entity_test][entity_test][translatable]');
}
/**
* Returns the entity manager.
*
* @return \Drupal\Core\Entity\EntityManagerInterface
* The entity manager;
*/
protected function entityManager() {
return $this->container->get('entity.manager');
}
}
......@@ -222,8 +222,8 @@ protected function createEntity($values, $langcode, $bundle_name = NULL) {
if ($bundle_key = $entity_type->getKey('bundle')) {
$entity_values[$bundle_key] = $bundle_name ?: $this->bundle;
}
$controller = $this->container->get('entity.manager')->getStorage($this->entityTypeId);
if (!($controller instanceof SqlContentEntityStorage)) {
$storage = $this->container->get('entity_type.manager')->getStorage($this->entityTypeId);
if (!($storage instanceof SqlContentEntityStorage)) {
foreach ($values as $property => $value) {
if (is_array($value)) {
$entity_values[$property] = [$langcode => $value];
......
......@@ -30,13 +30,6 @@ class ContentTranslationUpdateTest extends UpdatePathTestBase {
*/
protected $entityDefinitionUpdateManager;
/**
* The entity manager service.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
*/
protected $entityManager;
/**
* The state service.
*
......@@ -52,7 +45,6 @@ protected function setUp() {
$this->database = \Drupal::database();
$this->entityDefinitionUpdateManager = \Drupal::entityDefinitionUpdateManager();
$this->entityManager = \Drupal::entityManager();
$this->state = \Drupal::state();
}
......
......@@ -96,7 +96,7 @@ public function testConfigImportUpdates() {
$this->assertIdentical($config->get('id'), $config_id);
// Verify that updates were performed.
$entity_type = $this->container->get('entity.manager')->getDefinition($entity_type_id);
$entity_type = $this->container->get('entity_type.manager')->getDefinition($entity_type_id);
$table = $entity_type->getDataTable();
$db_schema = $this->container->get('database')->schema();
$result = $db_schema->fieldExists($table, 'content_translation_source') && $db_schema->fieldExists($table, 'content_translation_outdated');
......
......@@ -75,7 +75,7 @@ public static function create(ContainerInterface $container, array $configuratio
$configuration['view_mode'],
$configuration['third_party_settings'],
$container->get('date.formatter'),
$container->get('entity.manager')->getStorage('date_format')
$container->get('entity_type.manager')->getStorage('date_format')
);
}
......
......@@ -49,7 +49,7 @@ public static function create(ContainerInterface $container, array $configuratio
$configuration['field_definition'],
$configuration['settings'],
$configuration['third_party_settings'],
$container->get('entity.manager')->getStorage('date_format')
$container->get('entity_type.manager')->getStorage('date_format')
);
}
......
......@@ -43,7 +43,7 @@ public function __construct(EntityStorageInterface $file_storage) {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager')->getStorage('file')
$container->get('entity_type.manager')->getStorage('file')
);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment