diff -u b/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php b/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php --- b/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php +++ b/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php @@ -89,8 +89,8 @@ $translatable = FALSE; if ($row->getSourceProperty('entity_type') == 'node') { if ($this->variableGet('language_content_type_' . $row->getSourceProperty('bundle'), 0) == 2) { - // If node translations are enabled for this content type, set - // translatable to true. + // If the drupal 7 variable, language_content_type for this bundle is 2 + // then translations are enabled. $translatable = TRUE; } } diff -u b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php --- b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php @@ -121,7 +121,7 @@ // Validate that the source count and processed count match up. /** @var \Drupal\migrate\Plugin\MigrationInterface $migration */ $migration = $this->getMigration('d7_field'); - $this->assertIdentical($migration->getSourcePlugin() + $this->assertSame($migration->getSourcePlugin() ->count(), $migration->getIdMap()->processedCount()); } interdiff impossible; taking evasive action reverted: --- b/core/modules/migrate_drupal/tests/fixtures/drupal7.php +++ a/core/modules/migrate_drupal/tests/fixtures/drupal7.php @@ -6129,30 +6129,6 @@ 'body_summary' => '', 'body_format' => 'filtered_html', )) -->values(array( - 'entity_type' => 'node', - 'bundle' => 'article', - 'deleted' => '0', - 'entity_id' => '4', - 'revision_id' => '4', - 'language' => 'und', - 'delta' => '0', - 'body_value' => 'is - Is that is it awesome.', - 'body_summary' => '', - 'body_format' => 'filtered_html', -)) -->values(array( - 'entity_type' => 'node', - 'bundle' => 'article', - 'deleted' => '0', - 'entity_id' => '5', - 'revision_id' => '5', - 'language' => 'und', - 'delta' => '0', - 'body_value' => 'en - Is that is it awesome.', - 'body_summary' => '', - 'body_format' => 'filtered_html', -)) ->execute(); $connection->schema()->createTable('field_revision_comment_body', array( @@ -30928,38 +30904,6 @@ 'tnid' => '2', 'translate' => '0', )) -->values(array( - 'nid' => '4', - 'vid' => '4', - 'type' => 'article', - 'language' => 'is', - 'title' => 'is - The thing about Firefly', - 'uid' => '1', - 'status' => '1', - 'created' => '1478755274', - 'changed' => '1478755274', - 'comment' => '2', - 'promote' => '1', - 'sticky' => '0', - 'tnid' => '4', - 'translate' => '0', -)) -->values(array( - 'nid' => '5', - 'vid' => '5', - 'type' => 'article', - 'language' => 'en', - 'title' => 'en - The thing about Firefly', - 'uid' => '1', - 'status' => '1', - 'created' => '1478755314', - 'changed' => '1478755314', - 'comment' => '2', - 'promote' => '1', - 'sticky' => '0', - 'tnid' => '4', - 'translate' => '0', -)) ->execute(); $connection->schema()->createTable('node_access', array( @@ -31104,22 +31048,6 @@ 'last_comment_uid' => '1', 'comment_count' => '0', )) -->values(array( - 'nid' => '4', - 'cid' => '0', - 'last_comment_timestamp' => '1478755274', - 'last_comment_name' => NULL, - 'last_comment_uid' => '1', - 'comment_count' => '0', -)) -->values(array( - 'nid' => '5', - 'cid' => '0', - 'last_comment_timestamp' => '1478755314', - 'last_comment_name' => NULL, - 'last_comment_uid' => '1', - 'comment_count' => '0', -)) ->execute(); $connection->schema()->createTable('node_counter', array( @@ -31174,27 +31102,15 @@ ->values(array( 'nid' => '2', 'totalcount' => '1', + 'daycount' => '1', - 'daycount' => '0', 'timestamp' => '1471428059', )) ->values(array( 'nid' => '3', 'totalcount' => '1', + 'daycount' => '1', - 'daycount' => '0', 'timestamp' => '1471428153', )) -->values(array( - 'nid' => '4', - 'totalcount' => '1', - 'daycount' => '1', - 'timestamp' => '1478755275', -)) -->values(array( - 'nid' => '5', - 'totalcount' => '1', - 'daycount' => '1', - 'timestamp' => '1478755314', -)) ->execute(); $connection->schema()->createTable('node_revision', array( @@ -31315,30 +31231,6 @@ 'promote' => '1', 'sticky' => '0', )) -->values(array( - 'nid' => '4', - 'vid' => '4', - 'uid' => '1', - 'title' => 'is - The thing about Firefly', - 'log' => '', - 'timestamp' => '1478755274', - 'status' => '1', - 'comment' => '2', - 'promote' => '1', - 'sticky' => '0', -)) -->values(array( - 'nid' => '5', - 'vid' => '5', - 'uid' => '1', - 'title' => 'en - The thing about Firefly', - 'log' => '', - 'timestamp' => '1478755314', - 'status' => '1', - 'comment' => '2', - 'promote' => '1', - 'sticky' => '0', -)) ->execute(); $connection->schema()->createTable('node_type', array( unchanged: --- a/core/modules/migrate_drupal/tests/fixtures/drupal7.php +++ b/core/modules/migrate_drupal/tests/fixtures/drupal7.php @@ -6141,6 +6141,30 @@ 'body_summary' => '', 'body_format' => 'filtered_html', )) +->values(array( + 'entity_type' => 'node', + 'bundle' => 'article', + 'deleted' => '0', + 'entity_id' => '4', + 'revision_id' => '4', + 'language' => 'und', + 'delta' => '0', + 'body_value' => 'is - Is that is it awesome.', + 'body_summary' => '', + 'body_format' => 'filtered_html', +)) +->values(array( + 'entity_type' => 'node', + 'bundle' => 'article', + 'deleted' => '0', + 'entity_id' => '5', + 'revision_id' => '5', + 'language' => 'und', + 'delta' => '0', + 'body_value' => 'en - Is that is it awesome.', + 'body_summary' => '', + 'body_format' => 'filtered_html', +)) ->execute(); $connection->schema()->createTable('field_revision_comment_body', array( @@ -30945,6 +30969,38 @@ 'tnid' => '2', 'translate' => '0', )) +->values(array( + 'nid' => '4', + 'vid' => '4', + 'type' => 'article', + 'language' => 'is', + 'title' => 'is - The thing about Firefly', + 'uid' => '1', + 'status' => '1', + 'created' => '1478755274', + 'changed' => '1478755274', + 'comment' => '2', + 'promote' => '1', + 'sticky' => '0', + 'tnid' => '4', + 'translate' => '0', +)) +->values(array( + 'nid' => '5', + 'vid' => '5', + 'type' => 'article', + 'language' => 'en', + 'title' => 'en - The thing about Firefly', + 'uid' => '1', + 'status' => '1', + 'created' => '1478755314', + 'changed' => '1478755314', + 'comment' => '2', + 'promote' => '1', + 'sticky' => '0', + 'tnid' => '4', + 'translate' => '0', +)) ->execute(); $connection->schema()->createTable('node_access', array( @@ -31089,6 +31145,22 @@ 'last_comment_uid' => '1', 'comment_count' => '0', )) +->values(array( + 'nid' => '4', + 'cid' => '0', + 'last_comment_timestamp' => '1478755274', + 'last_comment_name' => NULL, + 'last_comment_uid' => '1', + 'comment_count' => '0', +)) +->values(array( + 'nid' => '5', + 'cid' => '0', + 'last_comment_timestamp' => '1478755314', + 'last_comment_name' => NULL, + 'last_comment_uid' => '1', + 'comment_count' => '0', +)) ->execute(); $connection->schema()->createTable('node_counter', array( @@ -31143,15 +31215,27 @@ ->values(array( 'nid' => '2', 'totalcount' => '1', - 'daycount' => '1', + 'daycount' => '0', 'timestamp' => '1471428059', )) ->values(array( 'nid' => '3', 'totalcount' => '1', - 'daycount' => '1', + 'daycount' => '0', 'timestamp' => '1471428153', )) +->values(array( + 'nid' => '4', + 'totalcount' => '1', + 'daycount' => '1', + 'timestamp' => '1478755275', +)) +->values(array( + 'nid' => '5', + 'totalcount' => '1', + 'daycount' => '1', + 'timestamp' => '1478755314', +)) ->execute(); $connection->schema()->createTable('node_revision', array( @@ -31272,6 +31356,30 @@ 'promote' => '1', 'sticky' => '0', )) +->values(array( + 'nid' => '4', + 'vid' => '4', + 'uid' => '1', + 'title' => 'is - The thing about Firefly', + 'log' => '', + 'timestamp' => '1478755274', + 'status' => '1', + 'comment' => '2', + 'promote' => '1', + 'sticky' => '0', +)) +->values(array( + 'nid' => '5', + 'vid' => '5', + 'uid' => '1', + 'title' => 'en - The thing about Firefly', + 'log' => '', + 'timestamp' => '1478755314', + 'status' => '1', + 'comment' => '2', + 'promote' => '1', + 'sticky' => '0', +)) ->execute(); $connection->schema()->createTable('node_type', array( reverted: --- b/core/modules/node/migration_templates/d7_node_translation.yml +++ /dev/null @@ -1,41 +0,0 @@ -id: d7_node_translation -label: Node translations -migration_tags: - - Drupal 7 -deriver: Drupal\node\Plugin\migrate\D7NodeDeriver -source: - plugin: d7_node - translations: true -process: - # If you are using this file to build a custom migration consider removing - # the nid and vid fields to allow incremental migrations. - nid: tnid - type: type - langcode: - plugin: default_value - source: language - default_value: "und" - title: title - uid: node_uid - status: status - created: created - changed: changed - promote: promote - sticky: sticky - revision_uid: revision_uid - revision_log: log - revision_timestamp: timestamp - content_translation_source: source_langcode -destination: - plugin: entity:node - translations: true - content_translation_update_definitions: - - node -migration_dependencies: - required: - - d7_user - - d7_node_type - - language - optional: - - d7_field_instance -provider: migrate_drupal diff -u b/core/modules/node/src/Plugin/migrate/D7NodeDeriver.php b/core/modules/node/src/Plugin/migrate/D7NodeDeriver.php --- b/core/modules/node/src/Plugin/migrate/D7NodeDeriver.php +++ b/core/modules/node/src/Plugin/migrate/D7NodeDeriver.php @@ -83,7 +83,7 @@ } // Read all CCK field instance definitions in the source database. - $fields = array(); + $fields = []; try { $source_plugin = static::getSourcePlugin('d7_field_instance'); $source_plugin->checkRequirements(); diff -u b/core/modules/node/src/Plugin/migrate/source/d7/Node.php b/core/modules/node/src/Plugin/migrate/source/d7/Node.php --- b/core/modules/node/src/Plugin/migrate/source/d7/Node.php +++ b/core/modules/node/src/Plugin/migrate/source/d7/Node.php @@ -2,6 +2,7 @@ namespace Drupal\node\Plugin\migrate\source\d7; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\migrate\Row; use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity; use Drupal\Core\Database\Query\SelectInterface; @@ -23,14 +24,14 @@ /** * The module handler. * - * @var \Drupal\Core\Extension\ModuleHandler + * @var \Drupal\Core\Extension\ModuleHandlerInterface */ protected $moduleHandler; /** * {@inheritdoc} */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager, ModuleHandler $module_handler) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler) { parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager); $this->moduleHandler = $module_handler; } @@ -49,6 +50,7 @@ $container->get('module_handler') ); } + /** * The join options between the node and the node_revisions table. */ diff -u b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeDeriverTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeDeriverTest.php --- b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeDeriverTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeDeriverTest.php @@ -10,6 +10,7 @@ * @group migrate_drupal_7 */ class MigrateNodeDeriverTest extends MigrateDrupal7TestBase { + /** * The migration plugin manager. * diff -u b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php --- b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php @@ -13,6 +13,9 @@ */ class MigrateNodeTest extends MigrateDrupal7TestBase { + /** + * {@inheritdoc} + */ public static $modules = array( 'content_translation', 'comment', @@ -150,7 +153,7 @@ $node = Node::load(2); $this->assertSame('en', $node->langcode->value); $this->assertIdentical("...is that it's the absolute best show ever. Trust me, I would know.", $node->body->value); - $this->assertSame('The thing about Deep Space 9', $node->title->value); + $this->assertSame('The thing about Deep Space 9', $node->label()); $this->assertIdentical('internal:/', $node->field_link->uri); $this->assertIdentical('Home', $node->field_link->title); $this->assertTrue($node->hasTranslation('is'), "Node 2 has an Icelandic translation"); @@ -158,7 +161,7 @@ $translation = $node->getTranslation('is'); $this->assertSame('is', $translation->langcode->value); $this->assertSame("is - ...is that it's the absolute best show ever. Trust me, I would know.", $translation->body->value); - $this->assertSame('is - The thing about Deep Space 9', $translation->title->value); + $this->assertSame('is - The thing about Deep Space 9', $translation->label()); $this->assertSame('internal:/', $translation->field_link->uri); $this->assertSame('Home', $translation->field_link->title); diff -u b/core/modules/node/tests/src/Kernel/Plugin/migrate/source/d7/NodeTest.php b/core/modules/node/tests/src/Kernel/Plugin/migrate/source/d7/NodeTest.php --- b/core/modules/node/tests/src/Kernel/Plugin/migrate/source/d7/NodeTest.php +++ b/core/modules/node/tests/src/Kernel/Plugin/migrate/source/d7/NodeTest.php @@ -27,7 +27,6 @@ // The source data. $tests[0]['source_data']['node'] = [ [ - // Node fields. 'nid' => 1, 'vid' => 1, 'type' => 'page', @@ -44,7 +43,6 @@ 'translate' => 0, ], [ - // Node fields. 'nid' => 2, 'vid' => 2, 'type' => 'page', @@ -61,7 +59,6 @@ 'translate' => 0, ], [ - // Node fields. 'nid' => 5, 'vid' => 5, 'type' => 'article', @@ -78,7 +75,6 @@ 'translate' => 0, ], [ - // Node fields. 'nid' => 6, 'vid' => 6, 'type' => 'article', @@ -95,7 +91,6 @@ 'translate' => 0, ], [ - // Node fields. 'nid' => 7, 'vid' => 7, 'type' => 'article', @@ -114,7 +109,6 @@ ]; $tests[0]['source_data']['node_revision'] = [ [ - // Node fields. 'nid' => 1, 'vid' => 1, 'uid' => 2, @@ -127,7 +121,6 @@ 'sticky' => 0, ], [ - // Node fields. 'nid' => 2, 'vid' => 2, 'uid' => 2, @@ -140,7 +133,6 @@ 'sticky' => 0, ], [ - // Node fields. 'nid' => 5, 'vid' => 5, 'uid' => 2, @@ -153,7 +145,6 @@ 'sticky' => 0, ], [ - // Node fields. 'nid' => 6, 'vid' => 6, 'uid' => 1, @@ -167,7 +158,6 @@ ], [ - // Node fields. 'nid' => 7, 'vid' => 7, 'uid' => 1, @@ -266,7 +256,6 @@ // The expected results. $tests[0]['expected_data'] = [ [ - // Node fields. 'nid' => 1, 'vid' => 1, 'type' => 'page', @@ -282,7 +271,6 @@ 'sticky' => 0, 'tnid' => 1, 'translate' => 0, - // Node revision fields. 'log' => '', 'timestamp' => 1279051598, 'body' => [ @@ -294,7 +282,6 @@ ], ], [ - // Node fields. 'nid' => 2, 'vid' => 2, 'type' => 'page', @@ -321,7 +308,6 @@ ], ], [ - // Node fields. 'nid' => 5, 'vid' => 5, 'type' => 'article', @@ -348,7 +334,6 @@ ], ], [ - // Node fields. 'nid' => 6, 'vid' => 6, 'type' => 'article',