diff -u b/core/modules/comment/src/CommentLinkBuilder.php b/core/modules/comment/src/CommentLinkBuilder.php --- b/core/modules/comment/src/CommentLinkBuilder.php +++ b/core/modules/comment/src/CommentLinkBuilder.php @@ -81,10 +81,11 @@ /** * Set the history repository service. - * @see https://www.drupal.org/node/2081585 * * @param \Drupal\history\HistoryRepositoryInterface $history_repository * The history repository service. + * + * @see https://www.drupal.org/node/2081585 */ public function setHistoryRepositoryService(HistoryRepositoryInterface $history_repository) { $this->historyRepository = $history_repository; diff -u b/core/modules/comment/src/CommentManager.php b/core/modules/comment/src/CommentManager.php --- b/core/modules/comment/src/CommentManager.php +++ b/core/modules/comment/src/CommentManager.php @@ -100,7 +100,7 @@ * @param \Drupal\Core\Entity\EntityDisplayRepositoryInterface $entity_display_repository * The entity display repository service. */ - public function __construct(EntityTypeManagerInterface $entity_type_manager, ConfigFactoryInterface $config_factory, TranslationInterface $string_translation, ModuleHandlerInterface $module_handler, AccountInterface $current_user, EntityFieldManagerInterface $entity_field_manager, EntityDisplayRepositoryInterface $entity_display_repository, HistoryRepositoryInterface $history_repository = NULL) { + public function __construct(EntityTypeManagerInterface $entity_type_manager, ConfigFactoryInterface $config_factory, TranslationInterface $string_translation, ModuleHandlerInterface $module_handler, AccountInterface $current_user, EntityFieldManagerInterface $entity_field_manager, EntityDisplayRepositoryInterface $entity_display_repository) { $this->entityTypeManager = $entity_type_manager; $this->userConfig = $config_factory->get('user.settings'); $this->stringTranslation = $string_translation; @@ -112,10 +112,11 @@ /** * Set the history repository service. - * @see https://www.drupal.org/node/2081585 * * @param \Drupal\history\HistoryRepositoryInterface $history_repository * The history repository service. + * + * @see https://www.drupal.org/node/2081585 */ public function setHistoryRepositoryService(HistoryRepositoryInterface $history_repository) { $this->historyRepository = $history_repository; diff -u b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php --- b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php +++ b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php @@ -83,7 +83,8 @@ $this->historyRepository = $this->createMock(HistoryRepositoryInterface::class); $this->moduleHandler = $this->createMock('\Drupal\Core\Extension\ModuleHandlerInterface'); $this->currentUser = $this->createMock('\Drupal\Core\Session\AccountProxyInterface'); - $this->commentLinkBuilder = new CommentLinkBuilder($this->currentUser, $this->commentManager, $this->moduleHandler, $this->stringTranslation, $this->entityTypeManager, $this->historyRepository); + $this->commentLinkBuilder = new CommentLinkBuilder($this->currentUser, $this->commentManager, $this->moduleHandler, $this->stringTranslation, $this->entityTypeManager); + $this->commentLinkBuilder->setHistoryRepositoryService($this->historyRepository); $this->commentManager->expects($this->any()) ->method('getFields') ->with('node') diff -u b/core/modules/comment/tests/src/Unit/CommentManagerTest.php b/core/modules/comment/tests/src/Unit/CommentManagerTest.php --- b/core/modules/comment/tests/src/Unit/CommentManagerTest.php +++ b/core/modules/comment/tests/src/Unit/CommentManagerTest.php @@ -62,9 +62,9 @@ $this->createMock('Drupal\Core\Extension\ModuleHandlerInterface'), $this->createMock(AccountInterface::class), $entity_field_manager, - $this->prophesize(EntityDisplayRepositoryInterface::class)->reveal(), - $history_repository + $this->prophesize(EntityDisplayRepositoryInterface::class)->reveal() ); + $comment_manager->setHistoryRepositoryService($history_repository); $comment_fields = $comment_manager->getFields('node'); $this->assertArrayHasKey('field_foobar', $comment_fields); } diff -u b/core/modules/history/history.install b/core/modules/history/history.install --- b/core/modules/history/history.install +++ b/core/modules/history/history.install @@ -25,7 +25,6 @@ 'description' => 'The type of the entity that was read.', 'type' => 'varchar_ascii', 'not null' => TRUE, - 'default' => '', 'length' => EntityTypeInterface::ID_MAX_LENGTH, ], 'entity_id' => [ @@ -61,7 +60,7 @@ /** * Change {history}.nid to {history}.entity_id and add {history}.entity_type. */ -function history_update_9001() { +function history_update_9101() { $database = Database::getConnection(); $schema = $database->schema(); $schema->dropPrimaryKey('history'); @@ -77,7 +76,6 @@ 'description' => 'The type of the entity that was read.', 'type' => 'varchar_ascii', 'not null' => TRUE, - 'default' => '', 'length' => EntityTypeInterface::ID_MAX_LENGTH, ]); @@ -100,7 +98,6 @@ 'description' => 'The type of the entity that was read.', 'type' => 'varchar_ascii', 'not null' => TRUE, - 'default' => '', 'length' => EntityTypeInterface::ID_MAX_LENGTH, ], 'entity_id' => [ diff -u b/core/modules/history/history.module b/core/modules/history/history.module --- b/core/modules/history/history.module +++ b/core/modules/history/history.module @@ -49,9 +49,11 @@ * * @deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use * \Drupal\history\HistoryRepositoryInterface::getLastViewed() instead. + * * @see https://www.drupal.org/node/2197189 */ function history_read($nid) { + @trigger_error('history_read() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use \Drupal\history\HistoryRepositoryInterface::getLastViewed() instead. See https://www.drupal.org/node/2197189', E_USER_DEPRECATED); $timestamps = \Drupal::service('history.repository')->getLastViewed('node', [$nid]); return $timestamps[$nid]; } @@ -72,6 +74,7 @@ * @see https://www.drupal.org/node/2197189 */ function history_read_multiple($nids) { + @trigger_error('history_read_multiple() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use \Drupal\history\HistoryRepositoryInterface::getLastViewed() instead. See https://www.drupal.org/node/2197189', E_USER_DEPRECATED); return \Drupal::service('history.repository')->getLastViewed('node', $nids); }