#1116408: Support migrate module: Destination handler class is about adding a migration destination handler for redirect.

This issue is about adding one destination class, so we can create migration classes that only import redirects. I have a use case where I am not importing other entities at the same time, so this is the only clean way I could think to do it.

Patch following, naturally it started with the code on the other issue, but it's a different migration destination class.

PS: I though it will be clear to have it in a separate issue, but I could merge this into the other issue if one of the maintainers think it's better.

Files: 
CommentFileSizeAuthor
#5 redirect-migrate-1607038-5.patch8.19 KBhussainweb
PASSED: [[SimpleTest]]: [MySQL] 101 pass(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new7.62 KB
PASSED: [[SimpleTest]]: [MySQL] 102 pass(es).
[ View ]

StatusFileSize
new8.09 KB
PASSED: [[SimpleTest]]: [MySQL] 102 pass(es).
[ View ]

Minor fixes: add inc to info file, change pk schema to avoid serial.

This worked pretty well for me.

Note that Migrate destination classes usually have the name starting with MigrateDestination, so instead of naming this class MigrateRedirectDestination you should name it MigrateDestinationRedirect.

I agree with #3.

I thought that redirect_migrate_api() should declare the destination class, but it looks like I was wrong.

Redirects are entities. (At least, the Redirect module implements hook_entity_info().) So why not extend MigrateDestinationEntity instead of MigrateDestination?

Assuming that both this issue and #1116408: Support migrate module: Destination handler class are adopted, there will be duplicated code: both define redirectValidate() methods. What is the best way to handle this? My inclination is to make it public here and then call this version in the destination-handler class. Currently it is protected there and private (why?) here.

Issue summary:View changes
StatusFileSize
new8.19 KB
PASSED: [[SimpleTest]]: [MySQL] 101 pass(es).
[ View ]

I have made some changes as per comments in #3 and #4. I have renamed the class, extended it from MigrateDestinationEntity and made redirectValidate method protected instead of private.

I tested this on a site i'm migrating, and this works as advertised. Code also looks good.
Not sure if its possible to add a destination for is_new, which is used to generate the hashes.
Otherwise it looks good.