Any migration can't be executed because of fatal error about undefined method:

Fatal error: Call to undefined method MigrateDestinationOGMembership::getTypesHandled() in migrate/migrate_ui/migrate_ui.pages.inc on line 842

How to reproduce

1. Create fresh install with og, migrate and dependent modules. Please, see Drush make file below.
2. Go to 'admin/content/migrate/handlers'

projects[entity][version] = 1.0-rc3
projects[entityreference][version] = 1.0-rc5
projects[views_bulk_operations][version] = 3.0
projects[views][version] = 3.5
projects[ctools][version] = 1.2
projects[og][version] = 2.0-beta3
projects[migrate][version] = 2.5
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

danylevskyi’s picture

I am not sure that is the right way, but at least it removes fatal error and migrations can be imported.

danylevskyi’s picture

Status: Active » Needs review
amitaibu’s picture

This looks strange, why does Migrate need to call MigrateDestinationOGMembership::getTypesHandled() in the first place?

joelstein’s picture

Status: Needs review » Reviewed & tested by the community

The patch worked great for me with the latest DEV.

amitaibu’s picture

The question in #3 still stands...

amitaibu’s picture

Project: Organic groups » Migrate
Component: og.module » Code
Category: bug » support

@mikeryan,
Is getTypesHandled needed in Migrate 2.5, or is this a bug?

svilleintel’s picture

Project: Migrate » Organic groups
Version: 7.x-2.0-beta3 » 7.x-2.x-dev
Component: Code » og.module
Priority: Major » Critical
Status: Reviewed & tested by the community » Patch (to be ported)
FileSize
327 bytes

A php error is logged
"PHP Fatal error: Call to undefined method MigrateDestinationOGMembership::handlesType() in .../profiles/commerce_kickstart/modules/contrib/migrate/migrate.module on line 201"

MigrateDestinationOGMembership is a MigrateDestination, and not a MigrateHandler and therefore does not implement a handlesType() function. However it is treated as if it were one, in file migrate.module::migrate_handler_invoke_all(), where this function gathers the list of handlers and fires handlesType() on each. It is included in the $class_list because og_migrate_api() lists it as a destination hander.

This is definitely the problem because as soon as I comment out the line specifying it as a 'destination handler' in og_migrate_api() everything begins working fine. I am then ABLE to import og_memberships using the MigrateDestinationOGMembership class aswell. It does not have an effect if it is commented out. I believe we can safely remove this line from the code and things should work as expected.

function og_migrate_api() {
$api = array(
....
//'destination handlers' => array(
// 'MigrateDestinationOGMembership',
//),
);
return $api;
}

I have included the patch this is all that needs to be done to fix it. The one above i believe is incorrect and is just hackish

svilleintel’s picture

Status: Needs review » Patch (to be ported)
FileSize
327 bytes

Same patch file as in my previous comment above just with proper filename (as I accidently opened a duplicate issue). Read my explanation above I belive i have answered comment #3. I think it would be better to apply this patch rather than the other one in the issue which just adds functions in to emulate as if the class where a MigrateHandler when it is not.

svilleintel’s picture

Status: Patch (to be ported) » Needs review
svilleintel’s picture

danylevskyi’s picture

Category: support » bug
Status: Patch (to be ported) » Reviewed & tested by the community

svilleintel, thanks!
Patch #8 works great.

amitaibu’s picture

Committed, thanks!

amitaibu’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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