Loading migrate_example/migrate_example_setup/migrate_example_setup.install +7 −7 Original line number Diff line number Diff line Loading @@ -327,7 +327,7 @@ function migrate_example_beer_data_node() { 'Blab Blah Blah Green', 'Green', 'Netherlands|Belgium', 0, 1, 'heineken.jpg', 'Heinekin alt', 'Heinekin title', Loading @@ -339,7 +339,7 @@ function migrate_example_beer_data_node() { 'We love Miller Brewing', 'Tasteless', 'USA|Canada', 1, 2, NULL, NULL, NULL, Loading @@ -351,7 +351,7 @@ function migrate_example_beer_data_node() { 'English occasionally get something right', 'A treat', 'United Kingdom', 1, 2, NULL, NULL, NULL, Loading Loading @@ -441,10 +441,10 @@ function migrate_example_beer_data_comment() { $query = \Drupal::database()->insert('migrate_example_beer_comment') ->fields($fields); $data = [ [99999998, NULL, 'im first', 'full body', 'alice', 'alice@example.com', 0], [99999998, NULL, 'im second', 'aromatic', 'alice', 'alice@example.com', 0], [99999999, NULL, 'im parent', 'malty', 'alice', 'alice@example.com', 0], [99999999, 1, 'im child', 'cold body', 'bob', NULL, 1], [99999998, NULL, 'im first', 'full body', 'alice', 'alice@example.com', 1], [99999998, NULL, 'im second', 'aromatic', 'alice', 'alice@example.com', 1], [99999999, NULL, 'im parent', 'malty', 'alice', 'alice@example.com', 1], [99999999, 1, 'im child', 'cold body', 'bob', NULL, 2], [ 99999999, 4, Loading migrate_example/tests/src/Kernel/MigrateExampleTest.php +1 −3 Original line number Diff line number Diff line Loading @@ -57,9 +57,7 @@ class MigrateExampleTest extends MigrateDrupalTestBase { */ public function testBeerMigration() { $users = \Drupal::entityTypeManager()->getStorage('user')->loadMultiple(); // There are 4 users created in beer_user migration and 1 stub entity // created during beer_node migration. $this->assertCount(5, $users); $this->assertCount(4, $users); $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadMultiple(); $this->assertCount(3, $terms); Loading migrate_json_example/migrate_json_example.install +3 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,9 @@ function migrate_json_example_install() { \Drupal::service('file_system')->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS); // Copy the example file to example directory. $module_path = drupal_get_path('module', 'migrate_json_example'); // @todo Use \Drupal\Core\Extension\ExtensionPathResolver::getPath() when we // require Drupal > 9.3.0. $module_path = \Drupal::moduleHandler()->getModule('migrate_json_example')->getPath(); $file_source = $module_path . '/artifacts/products.json'; \Drupal::service('file_system')->copy($file_source, $directory . '/products.json', FileSystemInterface::EXISTS_REPLACE); } src/DataParserPluginBase.php +7 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ abstract class DataParserPluginBase extends PluginBase implements DataParserPlug public function __construct(array $configuration, $plugin_id, $plugin_definition) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->urls = $configuration['urls']; $this->itemSelector = $configuration['item_selector']; $this->itemSelector = $configuration['item_selector'] ?? ''; } /** Loading @@ -89,6 +89,7 @@ abstract class DataParserPluginBase extends PluginBase implements DataParserPlug /** * {@inheritdoc} */ #[\ReturnTypeWillChange] public function rewind() { $this->activeUrl = NULL; $this->next(); Loading @@ -97,6 +98,7 @@ abstract class DataParserPluginBase extends PluginBase implements DataParserPlug /** * Implementation of Iterator::next(). */ #[\ReturnTypeWillChange] public function next() { $this->currentItem = $this->currentId = NULL; if (is_null($this->activeUrl)) { Loading Loading @@ -177,6 +179,7 @@ abstract class DataParserPluginBase extends PluginBase implements DataParserPlug /** * {@inheritdoc} */ #[\ReturnTypeWillChange] public function current() { return $this->currentItem; } Loading @@ -193,6 +196,7 @@ abstract class DataParserPluginBase extends PluginBase implements DataParserPlug /** * {@inheritdoc} */ #[\ReturnTypeWillChange] public function key() { return $this->currentId; } Loading @@ -200,6 +204,7 @@ abstract class DataParserPluginBase extends PluginBase implements DataParserPlug /** * {@inheritdoc} */ #[\ReturnTypeWillChange] public function valid() { return !empty($this->currentItem); } Loading @@ -207,6 +212,7 @@ abstract class DataParserPluginBase extends PluginBase implements DataParserPlug /** * {@inheritdoc} */ #[\ReturnTypeWillChange] public function count() { $count = 0; foreach ($this as $item) { Loading src/Plugin/migrate_plus/data_parser/XmlTrait.php +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ trait XmlTrait { '@libxmlerrormessage' => trim($error->message), '@libxmlerrorline' => $error->line, '@libxmlerrorcolumn' => $error->column, '@libxmlerrorfile' => (($error->file)) ? $error->file : NULL, '@libxmlerrorfile' => $error->file, ] ); } Loading Loading
migrate_example/migrate_example_setup/migrate_example_setup.install +7 −7 Original line number Diff line number Diff line Loading @@ -327,7 +327,7 @@ function migrate_example_beer_data_node() { 'Blab Blah Blah Green', 'Green', 'Netherlands|Belgium', 0, 1, 'heineken.jpg', 'Heinekin alt', 'Heinekin title', Loading @@ -339,7 +339,7 @@ function migrate_example_beer_data_node() { 'We love Miller Brewing', 'Tasteless', 'USA|Canada', 1, 2, NULL, NULL, NULL, Loading @@ -351,7 +351,7 @@ function migrate_example_beer_data_node() { 'English occasionally get something right', 'A treat', 'United Kingdom', 1, 2, NULL, NULL, NULL, Loading Loading @@ -441,10 +441,10 @@ function migrate_example_beer_data_comment() { $query = \Drupal::database()->insert('migrate_example_beer_comment') ->fields($fields); $data = [ [99999998, NULL, 'im first', 'full body', 'alice', 'alice@example.com', 0], [99999998, NULL, 'im second', 'aromatic', 'alice', 'alice@example.com', 0], [99999999, NULL, 'im parent', 'malty', 'alice', 'alice@example.com', 0], [99999999, 1, 'im child', 'cold body', 'bob', NULL, 1], [99999998, NULL, 'im first', 'full body', 'alice', 'alice@example.com', 1], [99999998, NULL, 'im second', 'aromatic', 'alice', 'alice@example.com', 1], [99999999, NULL, 'im parent', 'malty', 'alice', 'alice@example.com', 1], [99999999, 1, 'im child', 'cold body', 'bob', NULL, 2], [ 99999999, 4, Loading
migrate_example/tests/src/Kernel/MigrateExampleTest.php +1 −3 Original line number Diff line number Diff line Loading @@ -57,9 +57,7 @@ class MigrateExampleTest extends MigrateDrupalTestBase { */ public function testBeerMigration() { $users = \Drupal::entityTypeManager()->getStorage('user')->loadMultiple(); // There are 4 users created in beer_user migration and 1 stub entity // created during beer_node migration. $this->assertCount(5, $users); $this->assertCount(4, $users); $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadMultiple(); $this->assertCount(3, $terms); Loading
migrate_json_example/migrate_json_example.install +3 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,9 @@ function migrate_json_example_install() { \Drupal::service('file_system')->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS); // Copy the example file to example directory. $module_path = drupal_get_path('module', 'migrate_json_example'); // @todo Use \Drupal\Core\Extension\ExtensionPathResolver::getPath() when we // require Drupal > 9.3.0. $module_path = \Drupal::moduleHandler()->getModule('migrate_json_example')->getPath(); $file_source = $module_path . '/artifacts/products.json'; \Drupal::service('file_system')->copy($file_source, $directory . '/products.json', FileSystemInterface::EXISTS_REPLACE); }
src/DataParserPluginBase.php +7 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ abstract class DataParserPluginBase extends PluginBase implements DataParserPlug public function __construct(array $configuration, $plugin_id, $plugin_definition) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->urls = $configuration['urls']; $this->itemSelector = $configuration['item_selector']; $this->itemSelector = $configuration['item_selector'] ?? ''; } /** Loading @@ -89,6 +89,7 @@ abstract class DataParserPluginBase extends PluginBase implements DataParserPlug /** * {@inheritdoc} */ #[\ReturnTypeWillChange] public function rewind() { $this->activeUrl = NULL; $this->next(); Loading @@ -97,6 +98,7 @@ abstract class DataParserPluginBase extends PluginBase implements DataParserPlug /** * Implementation of Iterator::next(). */ #[\ReturnTypeWillChange] public function next() { $this->currentItem = $this->currentId = NULL; if (is_null($this->activeUrl)) { Loading Loading @@ -177,6 +179,7 @@ abstract class DataParserPluginBase extends PluginBase implements DataParserPlug /** * {@inheritdoc} */ #[\ReturnTypeWillChange] public function current() { return $this->currentItem; } Loading @@ -193,6 +196,7 @@ abstract class DataParserPluginBase extends PluginBase implements DataParserPlug /** * {@inheritdoc} */ #[\ReturnTypeWillChange] public function key() { return $this->currentId; } Loading @@ -200,6 +204,7 @@ abstract class DataParserPluginBase extends PluginBase implements DataParserPlug /** * {@inheritdoc} */ #[\ReturnTypeWillChange] public function valid() { return !empty($this->currentItem); } Loading @@ -207,6 +212,7 @@ abstract class DataParserPluginBase extends PluginBase implements DataParserPlug /** * {@inheritdoc} */ #[\ReturnTypeWillChange] public function count() { $count = 0; foreach ($this as $item) { Loading
src/Plugin/migrate_plus/data_parser/XmlTrait.php +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ trait XmlTrait { '@libxmlerrormessage' => trim($error->message), '@libxmlerrorline' => $error->line, '@libxmlerrorcolumn' => $error->column, '@libxmlerrorfile' => (($error->file)) ? $error->file : NULL, '@libxmlerrorfile' => $error->file, ] ); } Loading