function UserData::delete

Same name in other branches
  1. 9 core/modules/user/src/UserData.php \Drupal\user\UserData::delete()
  2. 8.9.x core/modules/user/src/UserData.php \Drupal\user\UserData::delete()
  3. 10 core/modules/user/src/UserData.php \Drupal\user\UserData::delete()

File

core/modules/user/src/UserData.php, line 97

Class

UserData
Defines the user data service.

Namespace

Drupal\user

Code

public function delete($module = NULL, $uid = NULL, $name = NULL) {
    $query = $this->connection
        ->delete('users_data');
    // Cast scalars to array so we can consistently use an IN condition.
    if (isset($module)) {
        $query->condition('module', (array) $module, 'IN');
    }
    if (isset($uid)) {
        $query->condition('uid', (array) $uid, 'IN');
    }
    if (isset($name)) {
        $query->condition('name', (array) $name, 'IN');
    }
    $query->execute();
}

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