Commit 408c540c authored by alexpott's avatar alexpott

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
......@@ -108,7 +108,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition,
$container->get('token'),
$container->get('entity.manager'),
$container->get('entity_type.manager'),
$container->get('logger.factory')->get('action'),
$container->get('plugin.manager.mail'),
$container->get('language_manager'),
......
......@@ -24,7 +24,7 @@ class EntityViewController implements ContainerInjectionInterface {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
......
......@@ -19,8 +19,8 @@
* display settings, or just replicate the settings of the 'default' form mode,
* thus reducing the amount of form display configurations to keep track of.
*
* @see \Drupal\Core\Entity\EntityManagerInterface::getAllFormModes()
* @see \Drupal\Core\Entity\EntityManagerInterface::getFormModes()
* @see \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getAllFormModes()
* @see \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getFormModes()
*
* @ConfigEntityType(
* id = "entity_form_mode",
......
......@@ -13,10 +13,11 @@
* perform complex or long-running logic in response to the change. For
* example, a SQL-based storage handler may need to update the database schema.
*
* To support this, \Drupal\Core\Entity\EntityManagerInterface has methods to
* retrieve the last installed definitions as well as the definitions specified
* by the current codebase. It also has create/update/delete methods to bring
* the former up to date with the latter.
* To support this,
* \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface has methods
* to retrieve the last installed definitions as well as the definitions
* specified by the current codebase. It also has create/update/delete methods
* to bring the former up to date with the latter.
*
* However, it is not the responsibility of the entity manager to decide how to
* report the differences or when to apply each update. This interface is for
......
......@@ -16,7 +16,7 @@ class EntityDeleteMultipleAccessCheck implements AccessInterface {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
......
......@@ -13,9 +13,6 @@
* Deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. We cannot
* use the deprecated PHPDoc tag because this service class is still used in
* legacy code paths. Symfony would fail test cases with deprecation warnings.
*
* @todo Enforce the deprecation of each method once
* https://www.drupal.org/node/2578361 is in.
*/
class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
......@@ -52,6 +49,7 @@ public function clearCachedDefinitions() {
* @see https://www.drupal.org/node/2549139
*/
public function getDefinition($entity_type_id, $exception_on_invalid = TRUE) {
@trigger_error('EntityManagerInterface::getDefinition() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getDefinition() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getDefinition($entity_type_id, $exception_on_invalid);
}
......@@ -65,6 +63,7 @@ public function getDefinition($entity_type_id, $exception_on_invalid = TRUE) {
* @see https://www.drupal.org/node/2549139
*/
public function hasHandler($entity_type_id, $handler_type) {
@trigger_error('EntityManagerInterface::hasHandler() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::hasHandler() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->hasHandler($entity_type_id, $handler_type);
}
......@@ -77,6 +76,7 @@ public function hasHandler($entity_type_id, $handler_type) {
* @see https://www.drupal.org/node/2549139
*/
public function getStorage($entity_type_id) {
@trigger_error('EntityManagerInterface::getStorage() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getStorage() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getStorage($entity_type_id);
}
......@@ -90,6 +90,7 @@ public function getStorage($entity_type_id) {
* @see https://www.drupal.org/node/2549139
*/
public function getListBuilder($entity_type_id) {
@trigger_error('EntityManagerInterface::getListBuilder() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getListBuilder() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getListBuilder($entity_type_id);
}
......@@ -103,6 +104,7 @@ public function getListBuilder($entity_type_id) {
* @see https://www.drupal.org/node/2549139
*/
public function getFormObject($entity_type_id, $operation) {
@trigger_error('EntityManagerInterface::getFormObject() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getFormObject() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getFormObject($entity_type_id, $operation);
}
......@@ -116,6 +118,7 @@ public function getFormObject($entity_type_id, $operation) {
* @see https://www.drupal.org/node/2549139
*/
public function getRouteProviders($entity_type_id) {
@trigger_error('EntityManagerInterface::getRouteProviders() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getRouteProviders() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getRouteProviders($entity_type_id);
}
......@@ -129,6 +132,7 @@ public function getRouteProviders($entity_type_id) {
* @see https://www.drupal.org/node/2549139
*/
public function getViewBuilder($entity_type_id) {
@trigger_error('EntityManagerInterface::getViewBuilder() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getViewBuilder() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getViewBuilder($entity_type_id);
}
......@@ -142,6 +146,7 @@ public function getViewBuilder($entity_type_id) {
* @see https://www.drupal.org/node/2549139
*/
public function getAccessControlHandler($entity_type_id) {
@trigger_error('EntityManagerInterface::getAccessControlHandler() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getAccessControlHandler() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getAccessControlHandler($entity_type_id);
}
......@@ -154,6 +159,7 @@ public function getAccessControlHandler($entity_type_id) {
* @see https://www.drupal.org/node/2549139
*/
public function getHandler($entity_type_id, $handler_type) {
@trigger_error('EntityManagerInterface::getHandler() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getHandler() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getHandler($entity_type_id, $handler_type);
}
......@@ -167,6 +173,7 @@ public function getHandler($entity_type_id, $handler_type) {
* @see https://www.drupal.org/node/2549139
*/
public function createHandlerInstance($class, EntityTypeInterface $definition = NULL) {
@trigger_error('EntityManagerInterface::createHandlerInstance() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::createHandlerInstance() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->createHandlerInstance($class, $definition);
}
......@@ -807,6 +814,7 @@ public function getLastInstalledFieldStorageDefinitions($entity_type_id) {
* @see https://www.drupal.org/node/2549139
*/
public function getDefinitions() {
@trigger_error('EntityManagerInterface::getDefinitions() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getDefinitions() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getDefinitions();
}
......@@ -820,6 +828,7 @@ public function getDefinitions() {
* @see https://www.drupal.org/node/2549139
*/
public function hasDefinition($plugin_id) {
@trigger_error('EntityManagerInterface::hasDefinition() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::hasDefinition() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->hasDefinition($plugin_id);
}
......
......@@ -17,7 +17,7 @@ final class EntityTypeEvents {
* @Event
*
* @see \Drupal\Core\Entity\EntityTypeEvent
* @see \Drupal\Core\Entity\EntityManager::onEntityTypeCreate()
* @see \Drupal\Core\Entity\EntityTypeListenerInterface::onEntityTypeCreate()
* @see \Drupal\Core\Entity\EntityTypeEventSubscriberTrait
* @see \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::onEntityTypeCreate()
*
......@@ -35,7 +35,7 @@ final class EntityTypeEvents {
* @Event
*
* @see \Drupal\Core\Entity\EntityTypeEvent
* @see \Drupal\Core\Entity\EntityManager::onEntityTypeUpdate()
* @see \Drupal\Core\Entity\EntityTypeListenerInterface::onEntityTypeUpdate()
* @see \Drupal\Core\Entity\EntityTypeEventSubscriberTrait
* @see \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::onEntityTypeUpdate()
*
......@@ -53,7 +53,7 @@ final class EntityTypeEvents {
* @Event
*
* @see \Drupal\Core\Entity\EntityTypeEvent
* @see \Drupal\Core\Entity\EntityManager::onEntityTypeDelete()
* @see \Drupal\Core\Entity\EntityTypeListenerInterface::onEntityTypeDelete()
* @see \Drupal\Core\Entity\EntityTypeEventSubscriberTrait
* @see \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::onEntityTypeDelete()
*
......
......@@ -49,7 +49,7 @@ interface FieldableEntityInterface extends EntityInterface {
* An array of base field definitions for the entity type, keyed by field
* name.
*
* @see \Drupal\Core\Entity\EntityManagerInterface::getFieldDefinitions()
* @see \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldDefinitions()
* @see \Drupal\Core\Entity\FieldableEntityInterface::bundleFieldDefinitions()
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type);
......@@ -85,7 +85,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type);
* @return \Drupal\Core\Field\FieldDefinitionInterface[]
* An array of bundle field definitions, keyed by field name.
*
* @see \Drupal\Core\Entity\EntityManagerInterface::getFieldDefinitions()
* @see \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldDefinitions()
* @see \Drupal\Core\Entity\FieldableEntityInterface::baseFieldDefinitions()
*
* @todo WARNING: This method will be changed in
......@@ -121,7 +121,7 @@ public function getFieldDefinition($name);
* @return \Drupal\Core\Field\FieldDefinitionInterface[]
* An array of field definitions, keyed by field name.
*
* @see \Drupal\Core\Entity\EntityManagerInterface::getFieldDefinitions()
* @see \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldDefinitions()
*/
public function getFieldDefinitions();
......
......@@ -51,7 +51,7 @@ class DefaultSelection extends SelectionPluginBase implements ContainerFactoryPl
/**
* The entity type manager service.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
......
......@@ -33,7 +33,7 @@ class DefaultHtmlRouteProvider implements EntityRouteProviderInterface, EntityHa
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
......
......@@ -582,7 +582,7 @@
* @code
* $view_builder = \Drupal::entityTypeManager()->getViewBuilder('your_entity_type');
* // Or if you have a $container variable:
* $view_builder = $container->get('entity.manager')->getViewBuilder('your_entity_type');
* $view_builder = $container->get('entity_type.manager')->getViewBuilder('your_entity_type');
* @endcode
* Then, to build and render the entity:
* @code
......@@ -1940,7 +1940,7 @@ function hook_entity_bundle_field_info_alter(&$fields, \Drupal\Core\Entity\Entit
*
* @see hook_entity_field_storage_info_alter()
* @see \Drupal\Core\Field\FieldStorageDefinitionInterface
* @see \Drupal\Core\Entity\EntityManagerInterface::getFieldStorageDefinitions()
* @see \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldStorageDefinitions()
*/
function hook_entity_field_storage_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) {
if (\Drupal::entityTypeManager()->getStorage($entity_type->id()) instanceof DynamicallyFieldableEntityStorageInterface) {
......@@ -2176,7 +2176,7 @@ function hook_entity_extra_field_info() {
*
* @param array $info
* The array structure is identical to that of the return value of
* \Drupal\Core\Entity\EntityManagerInterface::getExtraFields().
* \Drupal\Core\Entity\EntityFieldManagerInterface::getExtraFields().
*
* @see hook_entity_extra_field_info()
*/
......
......@@ -17,10 +17,10 @@ interface ModuleUninstallValidatorInterface {
* Example implementation:
* @code
* public function validate($module) {
* $entity_types = $this->entityManager->getDefinitions();
* $entity_types = $this->entityTypeManager->getDefinitions();
* $reasons = array();
* foreach ($entity_types as $entity_type) {
* if ($module == $entity_type->getProvider() && $entity_type instanceof ContentEntityTypeInterface && $this->entityManager->getStorage($entity_type->id())->hasData()) {
* if ($module == $entity_type->getProvider() && $entity_type instanceof ContentEntityTypeInterface && $this->entityTypeManager->getStorage($entity_type->id())->hasData()) {
* $reasons[] = $this->t('There is content for the entity type: @entity_type', array('@entity_type' => $entity_type->getLabel()));
* }
* }
......
......@@ -17,7 +17,7 @@ final class FieldStorageDefinitionEvents {
* @Event
*
* @see \Drupal\Core\Field\FieldStorageDefinitionEvent
* @see \Drupal\Core\Entity\EntityManager::onFieldStorageDefinitionCreate()
* @see \Drupal\Core\Field\FieldStorageDefinitionListener::onFieldStorageDefinitionCreate
* @see \Drupal\Core\Field\FieldStorageDefinitionEventSubscriberTrait
*
* @var string
......@@ -34,7 +34,7 @@ final class FieldStorageDefinitionEvents {
* @Event
*
* @see \Drupal\Core\Field\FieldStorageDefinitionEvent
* @see \Drupal\Core\Entity\EntityManager::onFieldStorageDefinitionUpdate()
* @see \Drupal\Core\Field\FieldStorageDefinitionListener::onFieldStorageDefinitionUpdate()
* @see \Drupal\Core\Field\FieldStorageDefinitionEventSubscriberTrait
*
* @var string
......@@ -51,7 +51,7 @@ final class FieldStorageDefinitionEvents {
* @Event
*
* @see \Drupal\Core\Field\FieldStorageDefinitionEvent
* @see \Drupal\Core\Entity\EntityManager::onFieldStorageDefinitionDelete()
* @see \Drupal\Core\Field\FieldStorageDefinitionListener::onFieldStorageDefinitionDelete()
* @see \Drupal\Core\Field\FieldStorageDefinitionEventSubscriberTrait
*
* @var string
......
......@@ -82,7 +82,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')
);
}
......
......@@ -93,7 +93,7 @@ public static function create(ContainerInterface $container) {
return new static(
$container->get('app.root'),
$container->get('site.path'),
$container->get('entity.manager')->getStorage('user'),
$container->get('entity_type.manager')->getStorage('user'),
$container->get('state'),
$container->get('module_installer'),
$container->get('country_manager')
......
......@@ -42,7 +42,7 @@ public function __construct(EntityStorageInterface $storage) {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager')->getStorage('action')
$container->get('entity_type.manager')->getStorage('action')
);
}
......
......@@ -27,7 +27,7 @@ public function testEmptyActionList() {
// Ensure the empty text appears on the action list page.
/** @var $storage \Drupal\Core\Entity\EntityStorageInterface */
$storage = $this->container->get('entity.manager')->getStorage('action');
$storage = $this->container->get('entity_type.manager')->getStorage('action');
$actions = $storage->loadMultiple();
$storage->delete($actions);
$this->drupalGet('/admin/config/system/actions');
......
......@@ -49,7 +49,7 @@ public function __construct(FeedStorageInterface $feed_storage, ClientInterface
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager')->getStorage('aggregator_feed'),
$container->get('entity_type.manager')->getStorage('aggregator_feed'),
$container->get('http_client')
);
}
......
......@@ -50,7 +50,12 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
* {@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')
);
}
/**
......
......@@ -69,7 +69,7 @@ public function testOverviewPage() {
// Check if the fields in the table match with what's expected.
$link = $this->xpath('//table/tbody/tr//td[1]/a');
$this->assertEquals($feed->label(), $link[0]->getText());
$count = $this->container->get('entity.manager')->getStorage('aggregator_item')->getItemCount($feed);
$count = $this->container->get('entity_type.manager')->getStorage('aggregator_item')->getItemCount($feed);
$td = $this->xpath('//table/tbody/tr//td[2]');
$this->assertEquals(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), $td[0]->getText());
......@@ -80,7 +80,7 @@ public function testOverviewPage() {
// Check if the fields in the table match with what's expected.
$link = $this->xpath('//table/tbody/tr//td[1]/a');
$this->assertEquals($feed->label(), $link[0]->getText());
$count = $this->container->get('entity.manager')->getStorage('aggregator_item')->getItemCount($feed);
$count = $this->container->get('entity_type.manager')->getStorage('aggregator_item')->getItemCount($feed);
$td = $this->xpath('//table/tbody/tr//td[2]');
$this->assertEquals(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), $td[0]->getText());
}
......
......@@ -55,7 +55,7 @@ public function testBlockLinks() {
$this->assertText($block->label(), 'Feed block is displayed on the page.');
// Confirm items appear as links.
$items = $this->container->get('entity.manager')->getStorage('aggregator_item')->loadByFeed($feed->id(), 1);
$items = $this->container->get('entity_type.manager')->getStorage('aggregator_item')->loadByFeed($feed->id(), 1);
$links = $this->xpath('//a[@href = :href]', [':href' => reset($items)->getLink()]);
$this->assert(isset($links[0]), 'Item link found.');
......
......@@ -34,7 +34,7 @@ public function testDeleteFeed() {
// Delete feed.
$this->deleteFeed($feed1);
$this->assertText($feed2->label());
$block_storage = $this->container->get('entity.manager')->getStorage('block');
$block_storage = $this->container->get('entity_type.manager')->getStorage('block');
$this->assertNull($block_storage->load($block->id()), 'Block for the deleted feed was deleted.');
$this->assertEqual($block2->id(), $block_storage->load($block2->id())->id(), 'Block for not deleted feed still exists.');
......
......@@ -55,8 +55,8 @@ protected function setUp($import_test_views = TRUE) {
ViewTestData::createTestViews(get_class($this), ['aggregator_test_views']);
$this->itemStorage = $this->container->get('entity.manager')->getStorage('aggregator_item');
$this->feedStorage = $this->container->get('entity.manager')->getStorage('aggregator_feed');
$this->itemStorage = $this->container->get('entity_type.manager')->getStorage('aggregator_item');
$this->feedStorage = $this->container->get('entity_type.manager')->getStorage('aggregator_feed');
}
/**
......
......@@ -110,7 +110,7 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager, Exe
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager'),
$container->get('entity_type.manager'),
$container->get('plugin.manager.condition'),
$container->get('context.repository'),
$container->get('language_manager'),
......
......@@ -98,8 +98,8 @@ public static function create(ContainerInterface $container, array $configuratio
$plugin_id,
$plugin_definition,
$container->get('block.repository'),
$container->get('entity.manager')->getViewBuilder('block'),
$container->get('entity.manager')->getDefinition('block')->getListCacheTags()
$container->get('entity_type.manager')->getViewBuilder('block'),
$container->get('entity_type.manager')->getDefinition('block')->getListCacheTags()
);
}
......
......@@ -46,7 +46,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
$entity_manager = $container->get('entity.manager');
$entity_type_manager = $container->get('entity_type.manager');
$migration_configuration = [
'migration' => [
'd6_custom_block',
......@@ -57,7 +57,7 @@ public static function create(ContainerInterface $container, array $configuratio
$configuration,
$plugin_id,
$plugin_definition,
$entity_manager->getDefinition('block_content') ? $entity_manager->getStorage('block_content') : NULL,
$entity_type_manager->getDefinition('block_content') ? $entity_type_manager->getStorage('block_content') : NULL,
$container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_configuration, $migration)
);
}
......
......@@ -44,11 +44,11 @@ class BlockFormTest extends UnitTestCase {
protected $themeHandler;
/**
* The entity manager.
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $entityManager;
protected $entityTypeManager;
/**
* The mocked context repository.
......@@ -74,10 +74,10 @@ protected function setUp() {
$this->language = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
$this->contextRepository = $this->getMock('Drupal\Core\Plugin\Context\ContextRepositoryInterface');
$this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
$this->entityTypeManager = $this->getMock('Drupal\Core\Entity\EntityTypeManagerInterface');
$this->storage = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityStorageInterface');
$this->themeHandler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface');
$this->entityManager->expects($this->any())
$this->entityTypeManager->expects($this->any())
->method('getStorage')
->will($this->returnValue($this->storage));
......@@ -136,7 +136,7 @@ public function testGetUniqueMachineName() {
->method('getQuery')
->will($this->returnValue($query));
$block_form_controller = new BlockForm($this->entityManager, $this->conditionManager, $this->contextRepository, $this->language, $this->themeHandler, $this->pluginFormFactory->reveal());
$block_form_controller = new BlockForm($this->entityTypeManager, $this->conditionManager, $this->contextRepository, $this->language, $this->themeHandler, $this->pluginFormFactory->reveal());
// Ensure that the block with just one other instance gets the next available
// name suggestion.
......
......@@ -37,10 +37,10 @@ class BlockContentController extends ControllerBase {
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
$entity_manager = $container->get('entity.manager');
$entity_type_manager = $container->get('entity_type.manager');
return new static(
$entity_manager->getStorage('block_content'),
$entity_manager->getStorage('block_content_type'),
$entity_type_manager->getStorage('block_content'),
$entity_type_manager->getStorage('block_content_type'),
$container->get('theme_handler')
);
}
......
......@@ -33,9 +33,9 @@ public function __construct(EntityStorageInterface $block_content_storage) {
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
$entity_manager = $container->get('entity.manager');
$entity_type_manager = $container->get('entity_type.manager');
return new static(
$entity_manager->getStorage('block_content')
$entity_type_manager->getStorage('block_content')
);
}
......
......@@ -71,7 +71,7 @@ protected function getAdditionalCacheTagsForEntity(EntityInterface $entity) {
*/
public function testBlock() {
$block = $this->drupalPlaceBlock('block_content:' . $this->entity->uuid());
$build = $this->container->get('entity.manager')->getViewBuilder('block')->view($block, 'block');
$build = $this->container->get('entity_type.manager')->getViewBuilder('block')->view($block, 'block');
// Render the block.
// @todo The request stack manipulation won't be necessary once
......
......@@ -72,7 +72,7 @@ public function testListing() {
// Edit the entity using the operations link.
$blocks = $this->container
->get('entity.manager')
->get('entity_type.manager')
->getStorage('block_content')
->loadByProperties(['info' => $label]);
$block = reset($blocks);
......
......@@ -79,7 +79,7 @@ public function testListing() {
// Edit the entity using the operations link.
$blocks = $this->container
->get('entity.manager')
->get('entity_type.manager')
->getStorage('block_content')
->loadByProperties(['info' => $label]);
$block = reset($blocks);
......
......@@ -187,7 +187,7 @@ public function testsBlockContentAddTypes() {
// Get the custom block storage.
$storage = $this->container
->get('entity.manager')
->get('entity_type.manager')
->getStorage('block_content');
// Install all themes.
......
......@@ -51,9 +51,9 @@ public function __construct(EntityStorageInterface $node_storage, BookManagerInt
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
$entity_manager = $container->get('entity.manager');
$entity_type_manager = $container->get('entity_type.manager');
return new static(
$entity_manager->getStorage('node'),
$entity_type_manager->getStorage('node'),
$container->get('book.manager')
);
}
......
......@@ -78,7 +78,7 @@ public static function create(ContainerInterface $container, array $configuratio
$plugin_definition,
$container->get('request_stack'),
$container->get('book.manager'),
$container->get('entity.manager')->getStorage('node')
$container->get('entity_type.manager')->getStorage('node')
);
}
......