You are here

public static function OgMembership::create in Organic groups 8

Constructs a new entity object, without permanently saving it.

Parameters

array $values: (optional) An array of values to set, keyed by property name. If the entity type has bundles, the bundle key has to be specified.

Return value

static The entity object.

Overrides EntityBase::create

21 calls to OgMembership::create()
AccessByOgMembershipTest::testNonMemberRoleMembershipSave in tests/src/Kernel/Access/AccessByOgMembershipTest.php
Tests exception is thrown when trying to save non-member role.
GroupSubscribeFormTest::testIsStateActive in tests/src/Kernel/Form/GroupSubscribeFormTest.php
Tests subscribe confirmation related text.
MembershipManager::createMembership in src/MembershipManager.php
Creates an OG membership.
OgMembershipCreationTrait::createOgMembership in tests/src/Traits/OgMembershipCreationTrait.php
Creates a test membership.
OgMembershipTest::testGetGroup in tests/src/Kernel/Entity/OgMembershipTest.php
Tests getting the group that is associated with a membership.

... See full list

File

src/Entity/OgMembership.php, line 554

Class

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

Namespace

Drupal\og\Entity

Code

public static function create(array $values = []) {

  // Use the default membership type by default.
  $values += [
    'type' => OgMembershipInterface::TYPE_DEFAULT,
  ];
  return parent::create($values);
}