Comments

slashrsm’s picture

Status: Active » Needs review
slashrsm’s picture

StatusFileSize
new7.78 KB

A bit improved patch.

chx’s picture

Category: feature » task

Amazing! Love it. How could I test this? And, could you write a simpletest? We have many tests that check for the existence of a module and continue if it is there.

slashrsm’s picture

I could write an example. I can also write tests. I do not have much experience with this, so I'd need some help here. Mostly with selection of test cases.

chx’s picture

Well I have no idea what this would be useful for as I never worked with migrate myself :) but I am sure it's very useful. Can we use this for the reference update path perhaps...? And test that.

chx’s picture

Well I have no idea what this would be useful for as I never worked with migrate myself :) but I am sure it's very useful. Can we use this for the reference update path perhaps...? And test that.

slashrsm’s picture

I believe we could use it for that... In which stage is reference migration right now?

To give you an idea about my use-case. I have a media portal, where they have premium content. To activate premium access you get so called "premium number", which are imported daily into Drupal. When user enters premium number system checks if exists and saves this as "activation". In old system is this just a simple table connecting user and premium number. In new system, beeing developed, we use commerce_product_key for numbers and connect them to users via relation ("activation" in our case).

andyhawks’s picture

slashrsm: can you post an example implementation of MigrateRelationendpointsHandler? I'm using your MigrateDestinationRelation patch and unclear how to map the endpoints array here. Thanks!

slashrsm’s picture

Assigned: Unassigned » slashrsm
Status: Needs review » Needs work

I finally found some time to work on this. As soon I have any noticeable progress I'll post a patch against 7.x-1.x.

Here is my development sandbox: http://drupal.org/sandbox/slashrsm/1672590

chx’s picture

Waiting for the patch. Exciting!

slashrsm’s picture

I have already commited some things in my sandbox.

slashrsm’s picture

StatusFileSize
new19.81 KB

Attached patch kinda implements migration plugins and migration of entityreference, user_reference, node_reference and taxonomy_term_reference fields into relation. It already implements a simple configuration form under admin/structure/relation/migrate.

What definitely still needs to be done:
- more comments, polishing, code standards, ...
- validation at configuration form (check if selected relation type supports source and destination entities at all)
- test

So please take this patch more as a demonstration and a request for feedback about basic concepts than a finished thing.

slashrsm’s picture

Title: Migrate integration » Migrate integration & upgrade from *reference
rlmumford’s picture

Hi slashrsm, this is looking very promising. I'm going to have a crack now at running a migration from CSV into Relation. Is there a handler written for the RelationEndpointsField? If not, how does that work?

slashrsm’s picture

Unfortunatley not. I was thinking about the way to implement this, but I was unable to find a solution that would be flexible and general enough. Let me know if you have any ideas.

Anyway... I can be *really* easy implemented this way: http://drupalcode.org/sandbox/slashrsm/1672590.git/blob/refs/heads/maste...

slashrsm’s picture

StatusFileSize
new25.49 KB

Some more work done. Now we have more validation on configuration form. The basic shape of the module is now done. We need tests. I think this is the right time to give comments about architecture, code or UI. I'd rather refactor things now than later, when we have all tests done.

Looking forward to get some feedback....

slashrsm’s picture

Status: Needs work » Needs review
StatusFileSize
new39.84 KB

Some tests added. More to come. Let's see how they behave....

Status: Needs review » Needs work

The last submitted patch, 1606404_migrate_integration_18.patch, failed testing.

slashrsm’s picture

Status: Needs work » Needs review
StatusFileSize
new44.78 KB

Some more tests and it passes locally. Let's try it....

Status: Needs review » Needs work

The last submitted patch, 1606404_migrate_integration_20.patch, failed testing.

mikran’s picture

I think setUp is failing on testbot due to the missing modules. This is how it's done in relation.rules.test:

  function setUp() {
    parent::setUp('relation');
    // While setUp fails for non-existing modules, module_enable() doesn't.
    module_enable(array('rules'));
  }
slashrsm’s picture

Status: Needs work » Needs review
StatusFileSize
new44.95 KB

THX for the tip. Let's see if this fixes it.

Status: Needs review » Needs work

The last submitted patch, 1606404_migrate_integration_23.patch, failed testing.

slashrsm’s picture

Status: Needs work » Needs review
StatusFileSize
new44.95 KB

Status: Needs review » Needs work

The last submitted patch, 1606404_migrate_integration_25.patch, failed testing.

slashrsm’s picture

Status: Needs work » Needs review
StatusFileSize
new44.92 KB

Still passes locally. Let's try again.

Status: Needs review » Needs work

The last submitted patch, 1606404_migrate_integration_27.patch, failed testing.

slashrsm’s picture

Status: Needs work » Needs review
StatusFileSize
new44.95 KB

Let's try this....

Status: Needs review » Needs work

The last submitted patch, 1606404_migrate_integration_29.patch, failed testing.

slashrsm’s picture

Status: Needs work » Needs review
StatusFileSize
new45.24 KB
chx’s picture

Move the test into the relation_migrate.info and then we can commit this , and the dependencies will be picked up by the bot on dev release.

slashrsm’s picture

StatusFileSize
new45.71 KB
new2.32 MB

OK. I did that and I also fixed some whitespace issues.

All tests pass locally. I only get one exception, which apparently happens in migrate, so I can do nothing about it. See the attached image....

mikran’s picture

Status: Needs review » Fixed

Committed, let's see what the test bot thinks about it. Thanks slashrsm

slashrsm’s picture

Great. Thanks to everybody that helped with this.

Would it be reasonable to add "Relation migrate" under component drop-down?

mikran’s picture

Component: Miscellaneous » Relation migrate

done :)

slashrsm’s picture

Great!

Status: Fixed » Closed (fixed)

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