This source class should read the node revision table, ignore the current revision data (LEFT JOIN node n ON nr.vid=n.vid WHERE n.vid IS NULL) and add field revision data in prepareRow.

Comments

chx’s picture

> the nodes must be set to pull the *original* version, not the latest version.

Nope. We are not doing this. Nodes and revisions are going to be saved completely separately, node migration being, revision migrate being another, each revision as a separate row.

Anonymous’s picture

Issue summary: View changes
chx’s picture

Issue summary: View changes
chx’s picture

Issue summary: View changes
chx’s picture

Issue summary: View changes
pcambra’s picture

Assigned: Unassigned » pcambra
pcambra’s picture

Status: Active » Needs review
Issue tags: +LONDON_2014_JANUARY, +#SprintWeekend2014
StatusFileSize
new6.42 KB

Here's a preliminar version, it might be a little horrible as I'm not sure how to test this.

Discussing with chx, node revisions should get the revisions but the current one in the query, including the CCK fields. As cck doesnt store revisions separately, the prepareRow should be fine so NodeRevision class extends Node.

Also, Node.php has changed a little for nor doing the query twice in prepareRow.

benjy’s picture

This breaks the node migration and the node source. Can we fix them up?

Also, you're probably aware, but the node revision test doesn't pass either?

chx’s picture

  1. There's no need for the nodeFields property. For the Node source, where you read from is AFAIK irrelevant because the data in node and the data in node_revision ought to be equal. So, read from nr what you can. Please correct me if I am wrong but I doubt I am wrong esp because rolling back would be broken otherwise.
  2. In prepareRow do not run $this->query() that's utterly pointless. You wanted $this->select($cck_table, 'f')->condition(f.vid, $row->getSourceProperty('vid')). This likely will unbreak the tests #8 mentions.

otherwise great work, thanks much.

pcambra’s picture

StatusFileSize
new16.61 KB
new16 KB

Here's another iteration, thanks for the reviews.

Node revision tests are still not passing, but node ones are fixed with what chx suggested.

The problem I'm having is that I was assuming that the expected results for the Node tests were just fine and that was too much to assume, I think we should provide a different set of expected results as the Join changes a lot (Node tests should include only latest revision, and Node revision tests should include all but the latest revision).

I've included 4 node revisions in the expected results, but I'm not sure how the joins are being done because its getting the 4 from node (no join) plus 6 more (?) from the join in the executeJoins() method of FakeSelect.php, here:

          foreach ($this->databaseContents[$table_info['table']] as $candidate_row) {
            if ($row[$table_info['original_table_alias']]['result'][$table_info['original_field']] == $candidate_row[$table_info['added_field']]) {
              $joined = TRUE;
              $new_rows[] = $this->getNewRow($table_alias, $fields, $candidate_row, $row);
            }
          }

Also removed the $nodeFields property, but I'm having some issues on the expecting results checking for title in node instead of node_revisions.

benjy’s picture

StatusFileSize
new17.24 KB

Heres a copy of the test that passes, this test is quite complicated but it's fine for now.

pcambra’s picture

Discussing with benjy this morning, I think we might want to alter the migration to create a couple of nodes manually in the setUp method and have the revisions part in the expected results, but limit those to all revisions but the latest one and leave the fields attached to each revision?

chx’s picture

That sounds in line with what we are doing for other tests: we create vocabularies, fields etc as necessary.

chx’s picture

Assigned: pcambra » chx
chx’s picture

Assigned: chx » Unassigned

The node revision migration is committed.

chx’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

alimac’s picture

Issue tags: -#SprintWeekend2014 +SprintWeekend2014

Minor tag cleanup - please ignore.