Problem/Motivation

While #1116408: Support migrate module: Destination handler class works great if you are importing redirects that are tied to nodes and entities, I have the need to import redirects from a legacy site that were handed to me in a CSV file. That means we need something like a MigrateDestinationEntity for redirects, in addition to simply a field handler.
i.e.

"URL","Redirect URL"
"/Offer","/product040114001"

Proposed resolution

Create a MigrateDestinationRedirect, similar to MigrateDestinationNode.

Remaining tasks

  • Manual testing of MigrateDestinationRedirect

User interface changes

n/a

API changes

Instructions/example should be provided how to use the migrate destination.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

heddn’s picture

Here's a patch that provides the necessary functionality. Due to the large number of imported redirects I found some interesting situations. There is some additional logic to handle parsing out URL options that wasn't in #1116408: Support migrate module: Destination handler class that should be included over there, see extractUrlOptions(). I looked into creating a base class to handle this for both migration but without PHP 5.4 and traits, that isn't really possible because of class inheritance. The other solution extends MigrateDestinationHandler while this approach must extend MigrateDestinationEntity.

heddn’s picture

Status: Active » Needs review
heddn’s picture

Issue summary: View changes
benjifisher’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#1607038: Support migrate module: Individual destination class

This is a duplicate of #1607038: Support migrate module: Individual destination class. It would be great to compare the patch here with the latest one there, and propose an improved patch on the existing issue.