You are here

public function MigrateDestinationFieldCollection::rollback in Field collection 7

Delete a migrated collection.

Parameters

$key: Array of fields representing the key.

File

./field_collection.migrate.inc, line 176
Support for the Migrate API.

Class

MigrateDestinationFieldCollection
Destination class implementing migration into field_collection.

Code

public function rollback(array $key) {
  $item_id = reset($key);
  $this
    ->prepareRollback($item_id);
  $field_collection_item = field_collection_item_load($item_id);

  // If the collection wasn't imported then we can't roll it back, so check if
  // the loaded object is an instance of the FieldCollectionItemEntity class.
  if ($field_collection_item instanceof FieldCollectionItemEntity) {
    $field_collection_item
      ->delete();
  }
  $this
    ->completeRollback($item_id);
  return TRUE;
}