Closed (cannot reproduce)
Project:
Migrate
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 May 2013 at 13:05 UTC
Updated:
19 Jun 2013 at 14:18 UTC
The Redirect module cleans up it's redirects when an entity is deleted using the following code:
<?php
/**
* Implements hook_entity_delete().
*/
function redirect_entity_delete($entity, $entity_type) {
if (redirect_entity_type_supports_redirects($entity_type)) {
redirect_delete_by_entity_path($entity_type, $entity);
}
}
?>However, the Migrate module uses
<?php
node_delete_multiple($nids);
?>So hook_entity_delete() is never called. Is it possible that Migrate uses hook_entity_delete() as well, so that Redirects are deleted as well on rollbacks?
Comments
Comment #1
mikeryanhook_entity_delete() has nothing to do with the contrib Entity API's entity_delete() function, it is a core hook that is invoked when core entities are deleted - in particular in this case, it is invoked by node_delete_multiple(). Are you sure redirect_entity_delete() is not being called? What precisely is the symptom?
Comment #2
marty2081 commentedOur use case is that we want the old (ugly) paths of entities to redirect to the new path of the migrated entity. We accomplish this by creating redirects using the Redirect module's redirect_save() function in the complete() function of the Migration class. This works fine:
Where
$new_pathis obviously the new path alias for the migrated entity.When we perform a rollback of a migration however, the redirects are not removed. BarisW thought the issue was with
hook_entity_delete()not being called.Comment #3
mikeryanDon't forget to reset the issue status to "active" if you want your response to be reviewed in a timely fashion.
I think you need to dive a little deeper here - first, confirm whether redirect_entity_delete() is actually being called. Note that there is migration support for the redirect module in the issue queue: #1116408: Support migrate module: Destination handler class.
Comment #4
mikeryan