/** * @param MemberActivity $memberActivity * @param EmailCampaignStatistics $emailCampaignStatistics */ protected function incrementStatistics(MemberActivity $memberActivity, EmailCampaignStatistics $emailCampaignStatistics) { switch ($memberActivity->getAction()) { case MemberActivity::ACTIVITY_SENT: $marketingListItem = $emailCampaignStatistics->getMarketingListItem(); $marketingListItem->setLastContactedAt($memberActivity->getActivityTime()); $marketingListItem->setContactedTimes((int) $marketingListItem->getContactedTimes() + 1); break; case MemberActivity::ACTIVITY_OPEN: $emailCampaignStatistics->incrementOpenCount(); break; case MemberActivity::ACTIVITY_CLICK: $emailCampaignStatistics->incrementClickCount(); break; case MemberActivity::ACTIVITY_BOUNCE: $emailCampaignStatistics->incrementBounceCount(); break; case MemberActivity::ACTIVITY_ABUSE: $emailCampaignStatistics->incrementAbuseCount(); break; case MemberActivity::ACTIVITY_UNSUB: $emailCampaignStatistics->incrementUnsubscribeCount(); break; } }
/** * @param MemberActivity $entity * @return bool */ protected function isSkipped(MemberActivity $entity) { if (in_array($entity->getAction(), $this->singleInstanceActivities)) { $searchCondition = ['campaign' => $entity->getCampaign(), 'action' => $entity->getAction(), 'member' => $entity->getMember()]; return (bool) $this->findEntityByIdentityValues('OroCRM\\Bundle\\MailChimpBundle\\Entity\\MemberActivity', $searchCondition); } return false; }
/** * @param MemberActivity $entity * @return bool */ protected function isSkipped(MemberActivity $entity) { if (in_array($entity->getAction(), $this->singleInstanceActivities)) { $searchCondition = ['campaign' => $entity->getCampaign(), 'action' => $entity->getAction(), 'member' => $entity->getMember()]; return (bool) $this->findEntityByIdentityValues(ClassUtils::getClass($entity), $searchCondition); } return false; }