You are here

static function PartyDefaultDataSet::runMerge in Party 7

Merge two data set controllers together.

At the moment this function only works for single cardinality data sets. It merges the first entity on $merger_controller into the first entity on $master_controller.

@todo Review this and come up with a better methodology.

File

includes/party.data.inc, line 221
Provides the default class for managing party - Attached entity relationships.

Class

PartyDefaultDataSet
Class PartyDefaultDataSet

Code

static function runMerge($master_controller, $merger_controller) {
  if (!$master_controller
    ->getEntity() && $merger_controller
    ->getEntity()) {
    $master_controller
      ->attachEntity($merger_controller
      ->getEntity());
    $merger_controller
      ->detachEntityByDelta(0);
    $merger_controller
      ->save();
    $master_controller
      ->save(TRUE);
  }
}