public function UserSyncEventSubscriber::__construct in SAML Authentication 4.x
Same name and namespace in other branches
- 8.3 src/EventSubscriber/UserSyncEventSubscriber.php \Drupal\samlauth\EventSubscriber\UserSyncEventSubscriber::__construct()
- 8.2 src/EventSubscriber/UserSyncEventSubscriber.php \Drupal\samlauth\EventSubscriber\UserSyncEventSubscriber::__construct()
Constructs a new SamlauthUserSyncSubscriber.
Parameters
\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory.
\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The EntityTypeManager service.
\Drupal\Core\TypedData\TypedDataManagerInterface $typed_data_manager: The typed data manager.
\Drupal\Component\Utility\EmailValidatorInterface $email_validator: The email validator. Note the code defines it as \Egulias\EmailValidator\EmailValidator for the time being; reason:
- The default service used to be \Egulias\EmailValidator\EmailValidator, which in v1 only had one required argument. (v2 has two.)
- From core 8.7, \Drupal\Component\Utility\EmailValidatorInterface was introduced, and the service now implements that interface AND still extends \Egulias\EmailValidator\EmailValidator, but makes the 2nd argument optional (and in fact, unusable) for backward compatibility.
We already typehint the interface in comments, otherwise the call to isValid() will appear to contain errors. But we don't want to mandate Core >= 8.7 just yet, so the 'use' statement is still not updated.
\Psr\Log\LoggerInterface $logger: A logger instance.
\Drupal\Core\Messenger\MessengerInterface $messenger: The messenger service.
\Drupal\Core\StringTranslation\TranslationInterface $translation: The string translation service.
File
- src/
EventSubscriber/ UserSyncEventSubscriber.php, line 102
Class
- UserSyncEventSubscriber
- Event subscriber that synchronizes user properties on a user_sync event.
Namespace
Drupal\samlauth\EventSubscriberCode
public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, TypedDataManagerInterface $typed_data_manager, EmailValidator $email_validator, LoggerInterface $logger, MessengerInterface $messenger, TranslationInterface $translation) {
$this->entityTypeManager = $entity_type_manager;
$this->emailValidator = $email_validator;
$this->logger = $logger;
$this->typedDataManager = $typed_data_manager;
$this->config = $config_factory
->get('samlauth.authentication');
$this
->setStringTranslation($translation);
}