Beispiel #1
0
 /**
  * Create the recipient source.
  *
  * @param RecipientSource $recipientSourceData
  *
  * @return \Avisota\RecipientSource\RecipientSourceInterface
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function createRecipientSource(RecipientSource $recipientSourceData)
 {
     global $container;
     $clean = $recipientSourceData->getUnionClean();
     $recipientSourceIds = $recipientSourceData->getUnionRecipientSources();
     $unionRecipientSource = new Union();
     $unionRecipientSource->setClean($clean);
     foreach ($recipientSourceIds as $recipientSourceId) {
         $recipientSource = $container[sprintf('avisota.recipientSource.%s', $recipientSourceId)];
         $unionRecipientSource->addRecipientSource($recipientSource);
     }
     /** @var EventDispatcherInterface $eventDispatcher */
     $eventDispatcher = $GLOBALS['container']['event-dispatcher'];
     $event = new CreateRecipientSourceEvent($recipientSourceData, $unionRecipientSource);
     $eventDispatcher->dispatch(CoreEvents::CREATE_RECIPIENT_SOURCE, $event);
     return $event->getRecipientSource();
 }
Beispiel #2
0
 /**
  * @param $clean
  *
  * @return Union
  */
 protected function getUnionRecipientSource($clean)
 {
     $unionRecipientSource = new Union();
     $unionRecipientSource->setClean($clean);
     $unionRecipientSource->addRecipientSource($this->getRecipientSource());
     $unionRecipientSource->addRecipientSource($this->getRecipientSource());
     $unionRecipientSource->addRecipientSource($this->getRecipientSource());
     return $unionRecipientSource;
 }