/**
  * @param EmailOrigin $emailOrigin
  */
 protected function initEnv(EmailOrigin $emailOrigin)
 {
     $this->currentUser = $this->em->getReference('Oro\\Bundle\\UserBundle\\Entity\\User', $emailOrigin->getOwner()->getId());
     $this->currentOrganization = $this->em->getReference('Oro\\Bundle\\OrganizationBundle\\Entity\\Organization', $emailOrigin->getOrganization()->getId());
 }
示例#2
0
 /**
  * @param EmailModel  $model
  * @param \DateTime   $messageDate
  * @param EmailOrigin $origin
  *
  * @return EmailUser
  */
 protected function createEmailUser(EmailModel $model, $messageDate, EmailOrigin $origin)
 {
     $emailUser = $this->emailEntityBuilder->emailUser($model->getSubject(), $model->getFrom(), $model->getTo(), $messageDate, $messageDate, $messageDate, Email::NORMAL_IMPORTANCE, $model->getCc(), $model->getBcc(), $origin->getOwner(), $origin->getOrganization());
     if ($origin instanceof UserEmailOrigin && $origin->getMailbox() !== null) {
         $emailUser->setOwner(null);
         $emailUser->setMailboxOwner($origin->getMailbox());
     }
     return $emailUser;
 }