You are here

protected function UserSectionStorage::loadUserSections in Workbench Access 8

1 call to UserSectionStorage::loadUserSections()
UserSectionStorage::getUserSections in src/UserSectionStorage.php
Gets the editorial sections assigned to a user.

File

src/UserSectionStorage.php, line 93

Class

UserSectionStorage
Defines a class for storing and retrieving sections assigned to a user.

Namespace

Drupal\workbench_access

Code

protected function loadUserSections(AccessSchemeInterface $scheme, AccountInterface $account) {
  $query = $this
    ->sectionStorage()
    ->getAggregateQuery()
    ->condition('access_scheme', $scheme
    ->id())
    ->condition('user_id', $account
    ->id())
    ->groupBy('section_id')
    ->execute();
  $list = array_column($query, 'section_id');
  return $list;
}