diff --git a/relation.module b/relation.module index 58c3208..e98b521 100644 --- a/relation.module +++ b/relation.module @@ -267,7 +267,7 @@ function relation_entity_delete(EntityInterface $entity) { // Check if there is any relation. $relations_exist = \Drupal::entityTypeManager()->getStorage('relation')->getQuery() - ->range(0, 1) + ->count() ->execute(); if ($relations_exist) { // Delete relations to this entity. diff --git a/src/Tests/RelationUITest.php b/src/Tests/RelationUITest.php index 51caf58..b290b9c 100644 --- a/src/Tests/RelationUITest.php +++ b/src/Tests/RelationUITest.php @@ -79,19 +79,19 @@ class RelationUITest extends RelationTestBase { // Delete all relations and relation types. foreach ($this->relation_types as $relation_type) { - $relation_ids = \Drupal::entityQuery('relation')->condition('relation_type', $relation_type['relation_type'], '=')->execute(); + $relation_ids = \Drupal::entityQuery('relation')->condition('relation_type', $relation_type['id'], '=')->execute(); $type_manager = \Drupal::entityTypeManager()->getStorage('relation'); $relations = $type_manager->loadMultiple($relation_ids); $type_manager->delete($relations); - $relation_type_entity = RelationType::load($relation_type['relation_type']); + $relation_type_entity = RelationType::load($relation_type['id']); $relation_type_entity->delete(); - $this->assertFalse(RelationType::load($relation_type['relation_type'])); + $this->assertFalse(RelationType::load($relation_type['id'])); } // Test that there are no relation types and relations. - $relation_type_exist = \Drupal::entityTypeManager()->getStorage('relation_type')->getQuery()->range(0, 1)->execute(); + $relation_type_exist = \Drupal::entityTypeManager()->getStorage('relation_type')->getQuery()->count()->execute(); $this->assertFalse($relation_type_exist); - $relation_exist = \Drupal::entityTypeManager()->getStorage('relation')->getQuery()->range(0, 1)->execute(); + $relation_exist = \Drupal::entityTypeManager()->getStorage('relation')->getQuery()->count()->execute(); $this->assertFalse($relation_exist); // Delete another node.