You are here

protected function SmsVerification::setVerifiedValue in SMS Framework 8

Same name and namespace in other branches
  1. 2.x src/Plugin/migrate/destination/SmsVerification.php \Drupal\sms\Plugin\migrate\destination\SmsVerification::setVerifiedValue()
  2. 2.1.x src/Plugin/migrate/destination/SmsVerification.php \Drupal\sms\Plugin\migrate\destination\SmsVerification::setVerifiedValue()

Sets the verified value for the user entity.

Parameters

\Drupal\sms\Entity\PhoneNumberVerificationInterface $verification: The phone number verification for a given user entity.

int $delta: The specific item of the phone number field to set.

1 call to SmsVerification::setVerifiedValue()
SmsVerification::import in src/Plugin/migrate/destination/SmsVerification.php
Import the row.

File

src/Plugin/migrate/destination/SmsVerification.php, line 111

Class

SmsVerification
Destination plugin for SMS phone number verifications.

Namespace

Drupal\sms\Plugin\migrate\destination

Code

protected function setVerifiedValue(EntityPhoneNumberVerificationInterface $verification, $delta) {
  if (!isset($delta)) {
    $delta = 0;
  }
  $user_entity = $verification
    ->getEntity();
  $phone_number_settings = $this->phoneNumberVerificationService
    ->getPhoneNumberSettingsForEntity($user_entity);
  if ($user_entity && $phone_number_settings) {
    $phone_field_name = $phone_number_settings
      ->getFieldName('phone_number');
    $user_entity->{$phone_field_name}[$delta] = $verification
      ->getPhoneNumber();
    $user_entity
      ->save();
  }
}