public static function createMemberCampaign($member, $campaign, $registrationType = 'site') {
    /** @var \Drupal\openy_campaign\Entity\MemberCampaign $memberCampaign Create temporary MemberCampaign object. Will be saved later. */
    $memberCampaign = \Drupal::entityTypeManager()
      ->getStorage('openy_campaign_member_campaign')
      ->create([
        'campaign' => $campaign,
        'member' => $member,
        'registration_type' => $registrationType,
      ]);

    if (($memberCampaign instanceof MemberCampaign === FALSE) || empty($memberCampaign)) {
      \Drupal::logger('openy_campaign')
        ->error('Error while creating MemberCampaign temporary object.');

      return FALSE;
    }

    return $memberCampaign;
  }
public static function createMemberCampaign($member, $campaign, $registrationType = 'site') {
    /** @var \Drupal\openy_campaign\Entity\MemberCampaign $memberCampaign Create temporary MemberCampaign object. Will be saved later. */
    $memberCampaign = \Drupal::entityTypeManager()
      ->getStorage('openy_campaign_member_campaign')
      ->create([
        'campaign' => $campaign,
        'member' => $member,
        'registration_type' => $registrationType,
      ]);

    if (($memberCampaign instanceof MemberCampaign === FALSE) || empty($memberCampaign)) {
      \Drupal::logger('openy_campaign')
        ->error('Error while creating MemberCampaign temporary object.');

      return FALSE;
    }

    return $memberCampaign;
  }
public static function createMemberCampaign ( $ member , $ campaign , $ registrationType = 'site' ) { /** @var \Drupal\openy_campaign\Entity\MemberCampaign $memberCampaign Create temporary MemberCampaign object. Will be saved later. */ $ memberCampaign = \ Drupal :: entityTypeManager ( ) -> getStorage ( 'openy_campaign_member_campaign' ) -> create ( [ 'campaign' => $ campaign , 'member' => $ member , 'registration_type' => $ registrationType , ] ) ; if ( ( $ memberCampaign instanceof MemberCampaign === FALSE ) || empty ( $ memberCampaign ) ) { \ Drupal :: logger ( 'openy_campaign' ) -> error ( 'Error while creating MemberCampaign temporary object.' ) ; return FALSE ; } return $ memberCampaign ; }
Create MemberCampaign entity.

@param \Drupal\openy_campaign\Entity\Member $member
Member entity.
@param \Drupal\node\Entity\Node $campaign
Campaign node.
@param string $registrationType

@return bool | \Drupal\openy_campaign\Entity\MemberCampaign
FALSE or MemberCampaign entity

@throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
Create MemberCampaign entity .