diff --git a/core/modules/content_moderation/src/ModerationInformation.php b/core/modules/content_moderation/src/ModerationInformation.php index dd80ccbc014627bf5f5bf1ee94570e51dd19c642..f590a3262727526d5f23a64b9a9000cfb67d0b8d 100644 --- a/core/modules/content_moderation/src/ModerationInformation.php +++ b/core/modules/content_moderation/src/ModerationInformation.php @@ -82,27 +82,6 @@ public function shouldModerateEntitiesOfBundle(EntityTypeInterface $entity_type, return FALSE; } - /** - * {@inheritdoc} - */ - public function getLatestRevision($entity_type_id, $entity_id) { - @trigger_error(__METHOD__ . ' is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use RevisionableStorageInterface::getLatestRevisionId() and RevisionableStorageInterface::loadRevision() instead. See https://www.drupal.org/node/3087295', E_USER_DEPRECATED); - /** @var \Drupal\Core\Entity\ContentEntityStorageInterface $storage */ - $storage = $this->entityTypeManager->getStorage($entity_type_id); - return $storage->loadRevision($storage->getLatestRevisionId($entity_id)); - } - - /** - * {@inheritdoc} - */ - public function getLatestRevisionId($entity_type_id, $entity_id) { - @trigger_error(__METHOD__ . ' is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use RevisionableStorageInterface::getLatestRevisionId() instead. See https://www.drupal.org/node/3087295', E_USER_DEPRECATED); - /** @var \Drupal\Core\Entity\ContentEntityStorageInterface $storage */ - if ($storage = $this->entityTypeManager->getStorage($entity_type_id)) { - return $storage->getLatestRevisionId($entity_id); - } - } - /** * {@inheritdoc} */ @@ -133,14 +112,6 @@ public function getAffectedRevisionTranslation(ContentEntityInterface $entity) { } } - /** - * {@inheritdoc} - */ - public function isLatestRevision(ContentEntityInterface $entity) { - @trigger_error(__METHOD__ . ' is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use RevisionableInterface::isLatestRevision() instead. See https://www.drupal.org/node/3087295', E_USER_DEPRECATED); - return $entity->isLatestRevision(); - } - /** * {@inheritdoc} */ diff --git a/core/modules/content_moderation/src/ModerationInformationInterface.php b/core/modules/content_moderation/src/ModerationInformationInterface.php index ae915a9a609a1fabff26cb1700c9b0cf909a8052..9b750637d415e0ed4ce0dbf128b0cfe4cb9fd5fd 100644 --- a/core/modules/content_moderation/src/ModerationInformationInterface.php +++ b/core/modules/content_moderation/src/ModerationInformationInterface.php @@ -58,45 +58,6 @@ public function shouldModerateEntitiesOfBundle(EntityTypeInterface $entity_type, */ public function isModeratedEntityType(EntityTypeInterface $entity_type); - /** - * Loads the latest revision of a specific entity. - * - * @param string $entity_type_id - * The entity type ID. - * @param int $entity_id - * The entity ID. - * - * @return \Drupal\Core\Entity\ContentEntityInterface|null - * The latest entity revision or NULL, if the entity type / entity doesn't - * exist. - * - * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use - * RevisionableStorageInterface::getLatestRevisionId and - * RevisionableStorageInterface::loadRevision instead. - * - * @see https://www.drupal.org/node/3087295 - */ - public function getLatestRevision($entity_type_id, $entity_id); - - /** - * Returns the revision ID of the latest revision of the given entity. - * - * @param string $entity_type_id - * The entity type ID. - * @param int $entity_id - * The entity ID. - * - * @return int - * The revision ID of the latest revision for the specified entity, or - * NULL if there is no such entity. - * - * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use - * RevisionableStorageInterface::getLatestRevisionId instead. - * - * @see https://www.drupal.org/node/3087295 - */ - public function getLatestRevisionId($entity_type_id, $entity_id); - /** * Returns the revision ID of the default revision for the specified entity. * @@ -122,23 +83,6 @@ public function getDefaultRevisionId($entity_type_id, $entity_id); */ public function getAffectedRevisionTranslation(ContentEntityInterface $entity); - /** - * Determines if an entity is a latest revision. - * - * @param \Drupal\Core\Entity\ContentEntityInterface $entity - * A revisionable content entity. - * - * @return bool - * TRUE if the specified object is the latest revision of its entity, - * FALSE otherwise. - * - * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use - * RevisionableInterface::isLatestRevision instead. - * - * @see https://www.drupal.org/node/3087295 - */ - public function isLatestRevision(ContentEntityInterface $entity); - /** * Determines if a pending revision exists for the specified entity. * diff --git a/core/modules/content_moderation/tests/src/Kernel/ModerationInformationTest.php b/core/modules/content_moderation/tests/src/Kernel/ModerationInformationTest.php index e3852ad592f49962593559aec763f5af2edf1867..29b4baf48189fc72c9a586c824fac06e7b22afc1 100644 --- a/core/modules/content_moderation/tests/src/Kernel/ModerationInformationTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/ModerationInformationTest.php @@ -78,70 +78,6 @@ public function testGetDefaultRevisionId() { $this->assertSame(1, $default_revision_id); } - /** - * @covers ::getLatestRevisionId - * @group legacy - * @expectedDeprecation Drupal\content_moderation\ModerationInformation::getLatestRevisionId is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use RevisionableStorageInterface::getLatestRevisionId() instead. See https://www.drupal.org/node/3087295 - */ - public function testGetLatestRevisionId() { - $entity_test_rev = EntityTestRev::create([ - 'name' => 'Default Revision', - 'moderation_state' => 'published', - ]); - $entity_test_rev->save(); - - $entity_test_rev->name = 'Pending revision'; - $entity_test_rev->moderation_state = 'draft'; - $entity_test_rev->save(); - - // Check that moderation information service returns the correct latest - // revision ID. - $latest_revision_id = $this->moderationInformation->getLatestRevisionId('entity_test_rev', $entity_test_rev->id()); - $this->assertSame(2, $latest_revision_id); - } - - /** - * @covers ::getLatestRevision - * @group legacy - * @expectedDeprecation Drupal\content_moderation\ModerationInformation::getLatestRevision is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use RevisionableStorageInterface::getLatestRevisionId() and RevisionableStorageInterface::loadRevision() instead. See https://www.drupal.org/node/3087295 - */ - public function testGetLatestRevision() { - $entity_test_rev = EntityTestRev::create([ - 'name' => 'Default Revision', - 'moderation_state' => 'published', - ]); - $entity_test_rev->save(); - - $entity_test_rev->name = 'Pending revision'; - $entity_test_rev->moderation_state = 'draft'; - $entity_test_rev->save(); - - $latest_revision = $this->moderationInformation->getLatestRevision('entity_test_rev', $entity_test_rev->id()); - $this->assertEquals(2, $latest_revision->getRevisionId()); - } - - /** - * @covers ::isLatestRevision - * @group legacy - * @expectedDeprecation Drupal\content_moderation\ModerationInformation::isLatestRevision is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use RevisionableInterface::isLatestRevision() instead. See https://www.drupal.org/node/3087295 - */ - public function testIsLatestRevision() { - $entity_test_rev = EntityTestRev::create([ - 'name' => 'Default Revision', - 'moderation_state' => 'published', - ]); - $entity_test_rev->save(); - - $old_revision = clone $entity_test_rev; - - $entity_test_rev->name = 'Pending revision'; - $entity_test_rev->moderation_state = 'draft'; - $entity_test_rev->save(); - - $this->assertFalse($this->moderationInformation->isLatestRevision($old_revision)); - $this->assertTrue($this->moderationInformation->isLatestRevision($entity_test_rev)); - } - /** * @covers ::isDefaultRevisionPublished * @dataProvider isDefaultRevisionPublishedTestCases diff --git a/core/modules/content_moderation/tests/src/Kernel/NodeAccessTest.php b/core/modules/content_moderation/tests/src/Kernel/NodeAccessTest.php index 50d7f7acf3a221b012af11dcac820a1d2f0a730f..09220186d8f296fbc9960c9e4f5dfbfc25dcded3 100644 --- a/core/modules/content_moderation/tests/src/Kernel/NodeAccessTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/NodeAccessTest.php @@ -84,24 +84,4 @@ public function testGetDefaultRevisionId() { $this->assertEquals($node->getRevisionId(), $this->moderationInformation->getDefaultRevisionId('node', $node->id())); } - /** - * @covers \Drupal\content_moderation\ModerationInformation::getLatestRevisionId - * @group legacy - * @expectedDeprecation Drupal\content_moderation\ModerationInformation::getLatestRevisionId is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use RevisionableStorageInterface::getLatestRevisionId() instead. See https://www.drupal.org/node/3087295 - */ - public function testGetLatestRevisionId() { - // Create an admin user. - $user = $this->createUser([], NULL, TRUE); - \Drupal::currentUser()->setAccount($user); - - // Create a node. - $node = $this->createNode(['type' => 'page']); - $this->assertEquals($node->getRevisionId(), $this->moderationInformation->getLatestRevisionId('node', $node->id())); - - // Create a non-admin user. - $user = $this->createUser(); - \Drupal::currentUser()->setAccount($user); - $this->assertEquals($node->getRevisionId(), $this->moderationInformation->getLatestRevisionId('node', $node->id())); - } - }