public static function findMemberCampaign($membershipID, $campaignID) {
    $connection = \Drupal::service('database');
    /** @var \Drupal\Core\Database\Query\Select $query */
    $query = $connection->select('openy_campaign_member', 'm');
    $query->condition('m.membership_id', $membershipID);
    $query->join('openy_campaign_member_campaign', 'mc', 'm.id = mc.member');
    $query->condition('mc.campaign', $campaignID);
    $query->fields('mc', ['id']);
    $memberCampaignRes = $query->execute()->fetchField();

    return (!empty($memberCampaignRes)) ? $memberCampaignRes : FALSE;
  }
public static function findMemberCampaign($membershipID, $campaignID) {
    $connection = \Drupal::service('database');
    /** @var \Drupal\Core\Database\Query\Select $query */
    $query = $connection->select('openy_campaign_member', 'm');
    $query->condition('m.membership_id', $membershipID);
    $query->join('openy_campaign_member_campaign', 'mc', 'm.id = mc.member');
    $query->condition('mc.campaign', $campaignID);
    $query->fields('mc', ['id']);
    $memberCampaignRes = $query->execute()->fetchField();

    return (!empty($memberCampaignRes)) ? $memberCampaignRes : FALSE;
  }
public static function findMemberCampaign ( $ membershipID , $ campaignID ) { $ connection = \ Drupal :: service ( 'database' ) ; /** @var \Drupal\Core\Database\Query\Select $query */ $ query = $ connection -> select ( 'openy_campaign_member' , 'm' ) ; $ query -> condition ( 'm.membership_id' , $ membershipID ) ; $ query -> join ( 'openy_campaign_member_campaign' , 'mc' , 'm.id = mc.member' ) ; $ query -> condition ( 'mc.campaign' , $ campaignID ) ; $ query -> fields ( 'mc' , [ 'id' ] ) ; $ memberCampaignRes = $ query -> execute ( ) -> fetchField ( ) ; return ( ! empty ( $ memberCampaignRes ) ) ? $ memberCampaignRes : FALSE ; }
Find MemberCampaign ID if it already exists.

@param $membershipID
int Membership ID.
@param $campaignID
int Campaign node ID.

@return int | bool MemberCampaign ID or FALSE
Find MemberCampaign ID if it already exists .