function UserRequestSubscriber::__construct
Same name in other branches
- 9 core/modules/user/src/EventSubscriber/UserRequestSubscriber.php \Drupal\user\EventSubscriber\UserRequestSubscriber::__construct()
- 8.9.x core/modules/user/src/EventSubscriber/UserRequestSubscriber.php \Drupal\user\EventSubscriber\UserRequestSubscriber::__construct()
- 11.x core/modules/user/src/EventSubscriber/UserRequestSubscriber.php \Drupal\user\EventSubscriber\UserRequestSubscriber::__construct()
Constructs a new UserRequestSubscriber.
Parameters
\Drupal\Core\Session\AccountInterface $account: The current user.
\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager service.
\Drupal\Component\Datetime\TimeInterface|null $time: The time service.
File
-
core/
modules/ user/ src/ EventSubscriber/ UserRequestSubscriber.php, line 42
Class
- UserRequestSubscriber
- Updates the current user's last access time.
Namespace
Drupal\user\EventSubscriberCode
public function __construct(AccountInterface $account, EntityTypeManagerInterface $entity_type_manager, ?TimeInterface $time = NULL) {
$this->account = $account;
$this->entityTypeManager = $entity_type_manager;
if (!$time) {
@trigger_error('Calling ' . __METHOD__ . '() without the $time argument is deprecated in drupal:10.3.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3387233', E_USER_DEPRECATED);
$this->time = \Drupal::service(TimeInterface::class);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.