You are here

public function OgMembership::setGroup in Organic groups 8

Sets the group associated with the membership.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $group: The entity object.

Return value

\Drupal\og\OgMembershipInterface The updated OG Membership object.

Overrides OgMembershipInterface::setGroup

File

src/Entity/OgMembership.php, line 136

Class

OgMembership
The membership entity that connects a group and a user.

Namespace

Drupal\og\Entity

Code

public function setGroup(ContentEntityInterface $group) : OgMembershipInterface {
  $this
    ->set('entity_type', $group
    ->getEntityTypeId());
  $this
    ->set('entity_bundle', $group
    ->bundle());
  $this
    ->set('entity_id', $group
    ->id());
  return $this;
}