public function GroupRoleStorage::resetUserGroupRoleCache in Group 2.0.x
Same name and namespace in other branches
- 8 src/Entity/Storage/GroupRoleStorage.php \Drupal\group\Entity\Storage\GroupRoleStorage::resetUserGroupRoleCache()
Resets the internal, static cache used by ::loadByUserAndGroup().
Parameters
\Drupal\Core\Session\AccountInterface $account: The account to reset the cached group roles for.
\Drupal\group\Entity\GroupInterface $group: (optional) The group to reset the user's cached group roles for. Leave blank to reset the user's roles in all groups.
Overrides GroupRoleStorageInterface::resetUserGroupRoleCache
File
- src/
Entity/ Storage/ GroupRoleStorage.php, line 283
Class
- GroupRoleStorage
- Defines the storage handler class for group role entities.
Namespace
Drupal\group\Entity\StorageCode
public function resetUserGroupRoleCache(AccountInterface $account, GroupInterface $group = NULL) {
$uid = $account
->id();
if (isset($group)) {
unset($this->userGroupRoleIds[$uid][$group
->id()]);
}
else {
unset($this->userGroupRoleIds[$uid]);
}
}