By znerol on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
11.4.x
Introduced in version:
11.4.0
Issue links:
Description:
SessionManager::delete() is deprecated in Drupal 11.4.0 and is removed from Drupal 13.0.0. Use Drupal\Core\Session\UserSessionRepository::deleteAll() instead.
Before:
public function postSave(EntityStorageInterface $storage, $update = TRUE) {
parent::postSave($storage, $update);
if ($update) {
$session_manager = \Drupal::service('session_manager');
// If the password has been changed, delete all open sessions for the
// user and recreate the current one.
if ($this->pass->value != $this->getOriginal()->pass->value) {
$session_manager->delete($this->id());
// [...]
}
After:
public function postSave(EntityStorageInterface $storage, $update = TRUE) {
parent::postSave($storage, $update);
if ($update) {
$session_repository = \Drupal::service(UserSessionRepositoryInterface::class);
// If the password has been changed, delete all open sessions for the
// user and recreate the current one.
if ($this->pass->value != $this->getOriginal()->pass->value) {
$session_repository->deleteAll($this->id());
// [...]
}
Impacts:
Module developers