diff --git a/core/core.services.yml b/core/core.services.yml index dd8d66a374..fbb93c57c6 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -1163,13 +1163,6 @@ services: class: Drupal\Core\Entity\EntityAccessCheck tags: - { name: access_check, applies_to: _entity_access } - access_check.entity_bundles: - # Deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Specify the - # list of bundles in the entity parameter, under "bundle" key as a sequence, - # instead. See https://www.drupal.org/node/3155569. - class: Drupal\Core\Entity\EntityBundleAccessCheck - tags: - - { name: access_check, applies_to: _entity_bundles } access_check.entity_create: class: Drupal\Core\Entity\EntityCreateAccessCheck arguments: ['@entity_type.manager'] diff --git a/core/lib/Drupal/Core/Entity/EntityType.php b/core/lib/Drupal/Core/Entity/EntityType.php index 527930c067..629865d126 100644 --- a/core/lib/Drupal/Core/Entity/EntityType.php +++ b/core/lib/Drupal/Core/Entity/EntityType.php @@ -431,14 +431,6 @@ public function entityClassImplements($interface) { return is_subclass_of($this->getClass(), $interface); } - /** - * {@inheritdoc} - */ - public function isSubclassOf($class) { - @trigger_error(__METHOD__ . '() is deprecated in drupal:8.3.0 and is removed from drupal:10.0.0. Use Drupal\Core\Entity\EntityTypeInterface::entityClassImplements() instead. See https://www.drupal.org/node/2842808', E_USER_DEPRECATED); - return $this->entityClassImplements($class); - } - /** * {@inheritdoc} */ diff --git a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php index 5e31b9675e..b63e677e6e 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php @@ -360,23 +360,6 @@ public function setAccessClass($class); */ public function entityClassImplements($interface); - /** - * Indicates if the entity type is a subclass of the given class or interface. - * - * @param string $class - * The class or interface to check. - * - * @return bool - * TRUE if the entity type is a subclass of the class or interface. - * - * @deprecated in drupal:8.3.0 and is removed from drupal:10.0.0. - * Use Drupal\Core\Entity\EntityTypeInterface::entityClassImplements() - * instead. - * - * @see https://www.drupal.org/node/2842808 - */ - public function isSubclassOf($class); - /** * Sets the handlers for a given type. * diff --git a/core/lib/Drupal/Core/Entity/Query/Sql/Query.php b/core/lib/Drupal/Core/Entity/Query/Sql/Query.php index ad66a42972..1ba8c1f51c 100644 --- a/core/lib/Drupal/Core/Entity/Query/Sql/Query.php +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Query.php @@ -137,8 +137,7 @@ protected function prepare() { } if (is_null($this->accessCheck)) { - $this->accessCheck = TRUE; - @trigger_error('Relying on entity queries to check access by default is deprecated in drupal:9.2.0 and an error will be thrown from drupal:10.0.0. Call \Drupal\Core\Entity\Query\QueryInterface::accessCheck() with TRUE or FALSE to specify whether access should be checked. See https://www.drupal.org/node/3201242', E_USER_DEPRECATED); + throw new QueryException('Entity query must specify whether access should be checked.'); } if ($this->accessCheck) { $this->sqlQuery->addTag($this->entityTypeId . '_access'); diff --git a/core/lib/Drupal/Core/Entity/RevisionLogEntityTrait.php b/core/lib/Drupal/Core/Entity/RevisionLogEntityTrait.php index 4585155c42..4c4088eda9 100644 --- a/core/lib/Drupal/Core/Entity/RevisionLogEntityTrait.php +++ b/core/lib/Drupal/Core/Entity/RevisionLogEntityTrait.php @@ -123,24 +123,6 @@ public function setRevisionLogMessage($revision_log_message) { return $this; } - /** - * Gets the name of a revision metadata field. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * A content entity type definition. - * @param string $key - * The revision metadata key to get, must be one of 'revision_created', - * 'revision_user' or 'revision_log_message'. - * - * @return string - * The name of the field for the specified $key. - */ - protected static function getRevisionMetadataKey(EntityTypeInterface $entity_type, $key) { - @trigger_error(static::class . 'getRevisionMetadataKey() is deprecated in drupal:9.0.0 and is removed from drupal:10.0.0. Use $entity_type->getRevisionMetadataKey() instead. See: https://www.drupal.org/node/2831499', E_USER_DEPRECATED); - /** @var \Drupal\Core\Entity\ContentEntityTypeInterface $entity_type */ - return $entity_type->getRevisionMetadataKey($key); - } - /** * Gets the entity type definition. * diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php index bf35a517f3..e119f6b97c 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php @@ -3,6 +3,7 @@ namespace Drupal\KernelTests\Core\Entity; use Drupal\Core\Database\Database; +use Drupal\Core\Entity\Query\QueryException; use Drupal\entity_test\Entity\EntityTest; use Drupal\entity_test\Entity\EntityTestMulRev; use Drupal\field\Entity\FieldConfig; @@ -1358,11 +1359,10 @@ public function testToString() { /** * Test the accessCheck method is called. - * - * @group legacy */ public function testAccessCheckSpecified() { - $this->expectDeprecation('Relying on entity queries to check access by default is deprecated in drupal:9.2.0 and an error will be thrown from drupal:10.0.0. Call \Drupal\Core\Entity\Query\QueryInterface::accessCheck() with TRUE or FALSE to specify whether access should be checked. See https://www.drupal.org/node/3201242'); + $this->expectException(QueryException::class); + $this->expectExceptionMessage('Entity query must specify whether access should be checked.'); $this->storage->getQuery()->execute(); } diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityBundleAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityBundleAccessCheckTest.php deleted file mode 100644 index c50d3049b4..0000000000 --- a/core/tests/Drupal/Tests/Core/Entity/EntityBundleAccessCheckTest.php +++ /dev/null @@ -1,100 +0,0 @@ -prophesize(CacheContextsManager::class)->reveal(); - $container = new Container(); - $container->set('cache_contexts_manager', $cache_contexts_manager); - \Drupal::setContainer($container); - } - - /** - * Data provider. - */ - public function getBundleAndAccessResult() { - return [ - [ - 'article', - 'node:article', - AccessResult::allowed(), - ], - [ - 'page', - 'node:article', - AccessResult::neutral('The entity bundle does not match the route _entity_bundles requirement.'), - ], - [ - 'page', - 'node:article|page', - AccessResult::allowed(), - ], - [ - 'article', - 'node:article|page', - AccessResult::allowed(), - ], - [ - 'book_page', - 'node:article|page', - AccessResult::neutral('The entity bundle does not match the route _entity_bundles requirement.'), - ], - ]; - } - - /** - * @covers ::access - * - * @dataProvider getBundleAndAccessResult - */ - public function testRouteAccess($bundle, $access_requirement, $access_result) { - $route = new Route('/foo/{node}', [], ['_entity_bundles' => $access_requirement], ['parameters' => ['node' => ['type' => 'entity:node']]]); - /** @var \Drupal\Core\Session\AccountInterface $account */ - $account = $this->prophesize(AccountInterface::class)->reveal(); - - /** @var \Drupal\node\NodeInterface|\Prophecy\Prophecy\ObjectProphecy $node */ - $node = $this->prophesize(NodeInterface::class); - $node->bundle()->willReturn($bundle); - $node->getCacheContexts()->willReturn([]); - $node->getCacheTags()->willReturn([]); - $node->getCacheMaxAge()->willReturn(-1); - $node = $node->reveal(); - - /** @var \Drupal\Core\Routing\RouteMatchInterface|\Prophecy\Prophecy\ObjectProphecy $route_match */ - $route_match = $this->prophesize(RouteMatchInterface::class); - $route_match->getRawParameters()->willReturn(new InputBag(['node' => 1])); - $route_match->getParameters()->willReturn(new ParameterBag(['node' => $node])); - $route_match = $route_match->reveal(); - - $access_check = new EntityBundleAccessCheck(); - $this->expectDeprecation('The Drupal\Core\Entity\EntityBundleAccessCheck is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Specify the list of bundles in the entity parameter, under "bundle" key, as a sequence, instead. See https://www.drupal.org/node/3155569'); - $this->assertEquals($access_result, $access_check->access($route, $route_match, $account)); - } - -}