Update to Drupal 8.2.2. For more information, see https://www.drupal.org/project/drupal/releases/8.2.2
This commit is contained in:
parent
23ffed3665
commit
507b45a0ed
378 changed files with 11434 additions and 5542 deletions
|
@ -0,0 +1,6 @@
|
|||
name: 'Migrate entity test'
|
||||
type: module
|
||||
description: 'Support module for entity destination test.'
|
||||
package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\migrate_entity_test\Entity;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityBase;
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Field\BaseFieldDefinition;
|
||||
|
||||
/**
|
||||
* Defines a content entity type that has a string ID.
|
||||
*
|
||||
* @ContentEntityType(
|
||||
* id = "migrate_string_id_entity_test",
|
||||
* label = @Translation("String id entity test"),
|
||||
* base_table = "migrate_entity_test_string_id",
|
||||
* entity_keys = {
|
||||
* "id" = "id",
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
class StringIdEntityTest extends ContentEntityBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
|
||||
return [
|
||||
'id' => BaseFieldDefinition::create('integer')
|
||||
->setSetting('size', 'big')
|
||||
->setLabel('ID'),
|
||||
'version' => BaseFieldDefinition::create('string')
|
||||
->setLabel('Version'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
|
@ -18,9 +18,11 @@ function migrate_prepare_row_test_migrate_prepare_row(Row $row, MigrateSourceInt
|
|||
// Test both options for save_to_map.
|
||||
$data = $row->getSourceProperty('data');
|
||||
if ($data == 'skip_and_record') {
|
||||
// Record mapping but don't record a message.
|
||||
throw new MigrateSkipRowException('', TRUE);
|
||||
}
|
||||
elseif ($data == 'skip_and_dont_record') {
|
||||
throw new MigrateSkipRowException('', FALSE);
|
||||
// Don't record mapping but record a message.
|
||||
throw new MigrateSkipRowException('skip_and_dont_record message', FALSE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\migrate_prepare_row_test\Plugin\migrate\process;
|
||||
|
||||
use Drupal\migrate\MigrateExecutableInterface;
|
||||
use Drupal\migrate\MigrateSkipRowException;
|
||||
use Drupal\migrate\ProcessPluginBase;
|
||||
use Drupal\migrate\Row;
|
||||
|
||||
/**
|
||||
* Provides a testing process plugin that skips rows.
|
||||
*
|
||||
* @MigrateProcessPlugin(
|
||||
* id = "test_skip_row_process"
|
||||
* )
|
||||
*/
|
||||
class TestSkipRowProcess extends ProcessPluginBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
||||
// Test both options for save_to_map.
|
||||
$data = $row->getSourceProperty('data');
|
||||
if ($data == 'skip_and_record (use plugin)') {
|
||||
throw new MigrateSkipRowException('', TRUE);
|
||||
}
|
||||
elseif ($data == 'skip_and_dont_record (use plugin)') {
|
||||
throw new MigrateSkipRowException('', FALSE);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue