Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#8 | og-og-membership-undefined-method-1845468-2.patch.patch | 327 bytes | svilleintel |
#7 | og_memberships_migrate_plugin-1858756-1.patch | 327 bytes | svilleintel |
#1 | og-og-membership-undefined-method-1845468-1.patch | 1.14 KB | danylevskyi |
Comments
Comment #1
danylevskyiI am not sure that is the right way, but at least it removes fatal error and migrations can be imported.
Comment #2
danylevskyiComment #3
amitaibuThis looks strange, why does Migrate need to call MigrateDestinationOGMembership::getTypesHandled() in the first place?
Comment #4
joelstein CreditAttribution: joelstein commentedThe patch worked great for me with the latest DEV.
Comment #5
amitaibuThe question in #3 still stands...
Comment #6
amitaibu@mikeryan,
Is getTypesHandled needed in Migrate 2.5, or is this a bug?
Comment #7
svilleintel CreditAttribution: svilleintel commentedA 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
Comment #8
svilleintel CreditAttribution: svilleintel commentedSame 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.
Comment #9
svilleintel CreditAttribution: svilleintel commentedComment #10
svilleintel CreditAttribution: svilleintel commentedComment #11
danylevskyisvilleintel, thanks!
Patch #8 works great.
Comment #12
amitaibuCommitted, thanks!
Comment #13
amitaibu