I need to import a large # of registration setups and then actual registrations. I'm wondering what's the best way to do it. Right now I'm planning on hand coding the imports. I've read that the Dev version of Feeds importer can handle Registration line items, but not the Settings portion.

1. For the individual registrations I'm planning on using the Entity Api to create entities and fill in the fields. That seems straight forward, but I haven't tried it.

2. For the event Settings part, I'm planning on directly adding rows to the registration_entity table. It seems like it works, but I don't know what goes into the Settings column blob type.

Thanks

CommentFileSizeAuthor
#3 registration.inc_.txt5.94 KBbkat
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

omarel created an issue. See original summary.

bkat’s picture

I'm doing the same thing as part of a migration of a custom hand coded website into drupal 7. I'm using the migrate module to do all the heaving lifting.

So far, I have the registration settings working as follows:

1. Created content type and configured the settings how wanted. Let's call this content type league
2. Create a migration for league
3. We have two different types of leagues 'Draft' and 'Team'. I have a different registration type for these as we collect different information at registration time depending on the type of league.
4. In the migration class for league, I added a field mapping to maps from 'registration_type' in my source DB to the field name holding my registration (field_register I called it)
$this->addFieldMapping('field_register', 'registration_type');
5. to set up the settings, I added a complete() method to my migration class that tweaks the registration settings

public function complete($entity, stdClass $row) {
    $settings = registration_entity_settings('node', $entity->nid);
    if ($row->type == 'Hat') {
      $settings['capacity'] = $row->female_cap + $row->male_cap;
    } else {
      $settings['capacity'] = $row->team_cap;
    }

    $settings['open'] = str_replace('T', ' ', $row->reg_open);
    $settings['close'] = str_replace('T', ' ', $row->reg_close);
    $settings['settings']['from_address'] = $row->payee;
    $settings['settings'] = serialize($settings['settings']);
    registration_update_entity_settings('node', $entity->nid, $settings);
  }

As you can see, I'm setting capacity according to whether we're registering teams or individual players. I'm also setting the open and close registration dates. In my case, my source data is ISO format so I'm converting 2016-01-01T09:00:00 to "2016-01-01 09:00:00".

Its important to serialize $settings['settings'] before saving the updated settings via registration_update_entity_settings();

I'm just starting to look at how to import registrations. I will update after I make progress on that.

bkat’s picture

FileSize
5.94 KB

Here's a first cut at a MigrateDestinationHandler for Registration. Its class is MigrateDestinationRegistration and its based off MigrateDestinationProfile2 from migrate_extras.

I haven't tested a ton yet but will be doing that in the next few days.

john.oltman’s picture

Status: Active » Closed (outdated)