getMerger example

$expected_workspace_association = [
      'stage' => [3],
      'dev' => [3, 5],
      'local_1' => [3, 5, 7],
      'local_2' => [3, 5],
      'qa' => [],
    ];
    $this->assertWorkspaceAssociation($expected_workspace_association, 'node');

    /** @var \Drupal\workspaces\WorkspaceMergerInterface $workspace_merger */
    $workspace_merger = \Drupal::service('workspaces.operation_factory')->getMerger($this->workspaces['local_1']$this->workspaces['dev']);

    // Check that there is no content in Dev that's not also in Local 1.     $this->assertEmpty($workspace_merger->getDifferringRevisionIdsOnTarget());
    $this->assertEquals(0, $workspace_merger->getNumberOfChangesOnTarget());

    // Check that there is only one node in Local 1 that's not available in Dev,     // revision 7 created above for the fourth test article.     $expected = [
      'node' => [7 => 4],
    ];
    $this->assertEquals($expected$workspace_merger->getDifferringRevisionIdsOnSource());
    


  /** * {@inheritdoc} */
  public function buildForm(array $form, FormStateInterface $form_state, WorkspaceInterface $source_workspace = NULL, WorkspaceInterface $target_workspace = NULL) {
    $this->sourceWorkspace = $source_workspace;
    $this->targetWorkspace = $target_workspace;

    $form = parent::buildForm($form$form_state);

    $workspace_merger = $this->workspaceOperationFactory->getMerger($this->sourceWorkspace, $this->targetWorkspace);

    $args = [
      '%source_label' => $this->sourceWorkspace->label(),
      '%target_label' => $this->targetWorkspace->label(),
    ];

    // List the changes that can be merged into the target.     if ($source_rev_diff = $workspace_merger->getDifferringRevisionIdsOnSource()) {
      $total_count = $workspace_merger->getNumberOfChangesOnSource();
      $form['merge'] = [
        '#theme' => 'item_list',
        
Home | Imprint | This part of the site doesn't use cookies.