Problem/Motivation

There are some functions in .module file that are not needed any more or are things solved in a different way in D8.

Proposed resolution

- Kill relation_type_load() and replace all it's usages with an appropriate call to a function on the entity class or storage controller.
- Kill relation_load() and replace all it's usages with an appropriate call to a function on the entity class or storage controller.
- Kill relation_uri() and relation_type_uri() and remove them from entity annotations.
- Kill relation_views_api()
- Kill relaton_insert() and replace it's usages with Relation::create(); $relation->save() two-liner.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

slashrsm created an issue. See original summary.

slashrsm’s picture

Issue summary: View changes
slashrsm’s picture

Issue summary: View changes
mbovan’s picture

Assigned: Unassigned » mbovan
mbovan’s picture

Fixed the points from the issue sumarry and while touching relation.module did some additional cleaning. (documentation, imports, function calls etc)

mbovan’s picture

Created a cleaning followup in CRM core #2700915: Remove usages of removed relation functions

CTaPByK’s picture

Status: Needs review » Needs work
+++ b/relation.module
@@ -452,22 +370,12 @@ function relation_entity_delete(Drupal\Core\Entity\EntityInterface $entity) {
   if (!empty($relations_to_delete)) {
-    entity_delete_multiple('relation', $relations_to_delete);
+    Relation::loadMultiple($relations_to_delete);
     \Drupal::logger('relation')->error('Relations @relations have been deleted.', array('@relations' => implode(', ', $relations_to_delete)));
   }

I think you forgot here to delete entities, you just load multiple, after that take storage and delete entities.

mbovan’s picture

Right. I reverted the change as there is a similar issue for deprecated functions #2697831: Remove usages of deprecated functions

CTaPByK’s picture

Yes there is a bunch of deprecated functions, so we need follow up for this. Patch is now looks good to me, but we must wait for tests to be committed to be sure this is RTBC.

The last submitted patch, 5: relation_module_clean_up-2697871-5.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 8: relation_module_clean_up-2697871-8.patch, failed testing.

The last submitted patch, 5: relation_module_clean_up-2697871-5.patch, failed testing.

The last submitted patch, 8: relation_module_clean_up-2697871-8.patch, failed testing.

mbovan’s picture

Rerolled.

CTaPByK’s picture

Status: Needs review » Reviewed & tested by the community

Looks ok.

  • mikran committed 81efa0c on 8.x-1.x authored by mbovan
    Issue #2697871 by mbovan: relation.module clean-up
    
mikran’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.