added userverification on user migration
This commit is contained in:
parent
fed4f8c9f7
commit
1480cba009
|
@ -2,8 +2,16 @@
|
|||
|
||||
namespace Drupal\materio_migrate\Plugin\migrate\source;
|
||||
|
||||
use Drupal\Core\Extension\ModuleHandlerInterface;
|
||||
use Drupal\migrate\Row;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
|
||||
use Drupal\Core\Database\Query\SelectInterface;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\Extension\ModuleHandler;
|
||||
use Drupal\Core\State\StateInterface;
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Drupal\user_email_verification\UserEmailVerificationInterface;
|
||||
|
||||
/**
|
||||
* Drupal 7 user source from database.
|
||||
|
@ -15,6 +23,46 @@ use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
|
|||
*/
|
||||
class D7Users extends FieldableEntity {
|
||||
|
||||
/**
|
||||
* User email verification helper service.
|
||||
*
|
||||
* @var \Drupal\user_email_verification\UserEmailVerificationInterface
|
||||
*/
|
||||
protected $userEmailVerification;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new UserEmailVerificationRequestForm object.
|
||||
*
|
||||
* @param \Drupal\user_email_verification\UserEmailVerificationInterface $user_email_verification_service
|
||||
* User email verification helper service.
|
||||
* @param \Drupal\Core\Session\AccountProxyInterface $current_user
|
||||
* The current active user.
|
||||
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
|
||||
* The request stack.
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler, UserEmailVerificationInterface $user_email_verification_service) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
|
||||
$this->userEmailVerification = $user_email_verification_service;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
|
||||
return new static(
|
||||
$configuration,
|
||||
$plugin_id,
|
||||
$plugin_definition,
|
||||
$migration,
|
||||
$container->get('state'),
|
||||
$container->get('entity.manager'),
|
||||
$container->get('module_handler'),
|
||||
$container->get('user_email_verification.service')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -180,6 +228,9 @@ class D7Users extends FieldableEntity {
|
|||
// abo01-C 2 (web+showroom)
|
||||
}
|
||||
|
||||
// set the user's email ferified
|
||||
$this->userEmailVerification->setEmailVerifiedByUserId($row->getSourceProperty('uid'));
|
||||
|
||||
// record migration errors in field_memo
|
||||
if(isset($memo)){
|
||||
$field_memo = $row->getSourceProperty('field_memo');
|
||||
|
|
Loading…
Reference in New Issue