Ejemplo n.º 1
0
 /**
  * @param CampaignExecutionEvent $event
  */
 public function onCampaignTriggerActionChangeLists(CampaignExecutionEvent $event)
 {
     if (!$event->checkContext('lead.changelist')) {
         return;
     }
     $addTo = $event->getConfig()['addToLists'];
     $removeFrom = $event->getConfig()['removeFromLists'];
     $lead = $event->getLead();
     $somethingHappened = false;
     if (!empty($addTo)) {
         $this->leadModel->addToLists($lead, $addTo);
         $somethingHappened = true;
     }
     if (!empty($removeFrom)) {
         $this->leadModel->removeFromLists($lead, $removeFrom);
         $somethingHappened = true;
     }
     return $event->setResult($somethingHappened);
 }