UserSessionRepository.php

Same filename and directory in other branches
  1. main core/lib/Drupal/Core/Session/UserSessionRepository.php

Namespace

Drupal\Core\Session

File

core/lib/Drupal/Core/Session/UserSessionRepository.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Core\Session;

use Drupal\Core\Database\Connection;

/**
 * Provides the default user session repository.
 */
readonly class UserSessionRepository implements UserSessionRepositoryInterface {
  public function __construct(protected Connection $connection) {
  }
  
  /**
   * {@inheritdoc}
   */
  public function deleteAll(int $uid) : void {
    try {
      // Delete session data.
      $this->connection
        ->delete('sessions')
        ->condition('uid', $uid)
        ->execute();
    } catch (\Exception) {
    }
  }

}

Classes

Title Deprecated Summary
UserSessionRepository Provides the default user session repository.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.