You are here

public function RefinableCalculatedGroupPermissions::merge in Group 2.0.x

Same name and namespace in other branches
  1. 8 src/Access/RefinableCalculatedGroupPermissions.php \Drupal\group\Access\RefinableCalculatedGroupPermissions::merge()

Merge another calculated group permissions object into this one.

This merges (not replaces) all permissions and cacheable metadata.

Parameters

\Drupal\group\Access\CalculatedGroupPermissionsInterface $other: The other calculated group permissions object to merge into this one.

Return value

$this

Overrides RefinableCalculatedGroupPermissionsInterface::merge

File

src/Access/RefinableCalculatedGroupPermissions.php, line 55

Class

RefinableCalculatedGroupPermissions
Represents a calculated set of group permissions with cacheable metadata.

Namespace

Drupal\group\Access

Code

public function merge(CalculatedGroupPermissionsInterface $calculated_permissions) {
  foreach ($calculated_permissions
    ->getItems() as $item) {
    $this
      ->addItem($item);
  }
  $this
    ->addCacheableDependency($calculated_permissions);
  return $this;
}