/** * @param MemberActivity $memberActivity * @param Channel $channel * @param Campaign $campaign * @return Member|null */ protected function findExistingMember(MemberActivity $memberActivity, Channel $channel, Campaign $campaign) { $searchCondition = ['channel' => $channel, 'subscribersList' => $campaign->getSubscribersList()]; $member = $memberActivity->getMember(); $email = $member ? $member->getEmail() : $memberActivity->getEmail(); if ($member && ($originId = $member->getOriginId())) { $searchCondition['originId'] = $originId; } elseif ($email) { $searchCondition['email'] = $email; } else { return null; } return $this->findEntityByIdentityValues('OroCRM\\Bundle\\MailChimpBundle\\Entity\\Member', $searchCondition); }
/** * @param Member $member * @param Channel $channel * @param Campaign $campaign * @return Member */ protected function findExistingMember(Member $member, Channel $channel, Campaign $campaign) { $searchCondition = ['channel' => $channel, 'subscribersList' => $campaign->getSubscribersList()]; if ($originId = $member->getOriginId()) { $searchCondition['originId'] = $originId; } else { $searchCondition['email'] = $member->getEmail(); } return $this->findEntityByIdentityValues(ClassUtils::getClass($member), $searchCondition); }