public function isMemberWinner(NodeInterface $campaign) {
    $isWinner = FALSE;

    $looseString = $campaign->field_campaign_prize_nowin->value;
    $userData = MemberCampaign::getMemberCampaignData($campaign->id());
    $memberCampaignID = MemberCampaign::findMemberCampaign($userData['membership_id'], $campaign->id());

    $memberGameStorage = $this->entityTypeManager->getStorage('openy_campaign_member_game');
    $query = $memberGameStorage->getQuery();
    $gameIds = $query->condition('member', $memberCampaignID)
      ->execute();

    $games = $memberGameStorage->loadMultiple($gameIds);
    foreach ($games as $game) {
      if (!empty($game->result->value) && $game->result->value != $looseString) {
        $isWinner = TRUE;
      }
    }

    return $isWinner;
  }
public function isMemberWinner(NodeInterface $campaign) {
    $isWinner = FALSE;

    $looseString = $campaign->field_campaign_prize_nowin->value;
    $userData = MemberCampaign::getMemberCampaignData($campaign->id());
    $memberCampaignID = MemberCampaign::findMemberCampaign($userData['membership_id'], $campaign->id());

    $memberGameStorage = $this->entityTypeManager->getStorage('openy_campaign_member_game');
    $query = $memberGameStorage->getQuery();
    $gameIds = $query->condition('member', $memberCampaignID)
      ->execute();

    $games = $memberGameStorage->loadMultiple($gameIds);
    foreach ($games as $game) {
      if (!empty($game->result->value) && $game->result->value != $looseString) {
        $isWinner = TRUE;
      }
    }

    return $isWinner;
  }
public function isMemberWinner ( NodeInterface $ campaign ) { $ isWinner = FALSE ; $ looseString = $ campaign -> field_campaign_prize_nowin -> value ; $ userData = MemberCampaign :: getMemberCampaignData ( $ campaign -> id ( ) ) ; $ memberCampaignID = MemberCampaign :: findMemberCampaign ( $ userData [ 'membership_id' ] , $ campaign -> id ( ) ) ; $ memberGameStorage = $ this -> entityTypeManager -> getStorage ( 'openy_campaign_member_game' ) ; $ query = $ memberGameStorage -> getQuery ( ) ; $ gameIds = $ query -> condition ( 'member' , $ memberCampaignID ) -> execute ( ) ; $ games = $ memberGameStorage -> loadMultiple ( $ gameIds ) ; foreach ( $ games as $ game ) { if ( ! empty ( $ game -> result -> value ) && $ game -> result -> value != $ looseString ) { $ isWinner = TRUE ; } } return $ isWinner ; }
Determines if the member was a winner at least once.

@param \Drupal\node\NodeInterface $campaign

@return bool
@throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
Determines if the member was a winner at least once .