Example #1
0
 /**
  * Message trace when a message has been initiated by php HTTP interface without domain user.
  *
  * @return Trace
  *
  * @throws Exception
  */
 public static function http()
 {
     $context = new Context();
     if ($context->isCli()) {
         throw new Exception('Not in php HTTP context');
     }
     return new self($context);
 }
Example #2
0
 /**
  * Adds a message trace to the message.
  *
  * @param TraceableMessage $message
  */
 private function traceMessage(TraceableMessage $message)
 {
     try {
         $user = $this->userRepository->getCurrentUser();
         $trace = Trace::user($user);
     } catch (AggregateRootNotFoundException $e) {
         if (Context::inCliContext()) {
             $trace = Trace::cli();
         } else {
             $trace = Trace::http();
         }
     }
     $message->trace($trace);
 }