protected function dispatchJob(kScope $scope, kEventNotificationDispatchJobData $jobData, $eventNotificationType = null)
 {
     $entryId = null;
     $parentJob = null;
     if ($scope instanceof kEventScope) {
         $event = $scope->getEvent();
         if ($event instanceof kApplicativeEvent) {
             $parentJob = $event->getRaisedJob();
         }
         $object = $scope->getObject();
         if ($object instanceof entry) {
             $entryId = $object->getId();
         } elseif (method_exists($object, 'getEntryId')) {
             $entryId = $object->getEntryId();
         }
     }
     if (!$eventNotificationType) {
         $eventNotificationType = $this->getType();
     }
     $job = $this->addEventNotificationDispatchJob($eventNotificationType, $jobData, $scope->getPartnerId(), $entryId, $parentJob);
     return $job->getId();
 }
예제 #2
0
 public function getQueueKey($contentParameters, $partnerId = null, kScope $scope = null)
 {
     $templateId = $this->getId();
     if ($scope) {
         $partnerId = $scope->getPartnerId();
     }
     // currently contentParams contains only one param (entryId), but for further support
     foreach ($contentParameters as $contentParameter) {
         /* @var $contentParameter kEventNotificationParameter */
         $value = $contentParameter->getValue();
         if ($value instanceof kStringField && $scope) {
             $value->setScope($scope);
         }
         $key = $contentParameter->getKey();
         $contentParametersValues[$key] = $value->getValue();
     }
     // sort array according to created keys
     ksort($contentParametersValues);
     $contentParamsHash = md5($partnerId . '_' . implode('_', array_values($contentParametersValues)));
     // prepare queue key to return
     return 'pn_' . $templateId . '_' . $contentParamsHash;
 }