コード例 #1
0
 /**
  * @param mixed $context
  */
 protected function executeAction($context)
 {
     $settingsClass = $this->contextAccessor->getValue($context, $this->processType);
     $settingsClass = $this->processStorage->getProcess($settingsClass)->getSettingsEntityFQCN();
     $email = $this->contextAccessor->getValue($context, $this->email);
     $results = $this->doctrine->getRepository('OroEmailBundle:Mailbox')->findBySettingsClassAndEmail($settingsClass, $email);
     $this->contextAccessor->setValue($context, $this->attribute, $results);
 }
コード例 #2
0
 public function setUp()
 {
     $this->contextAccessor = $this->getMock('Oro\\Bundle\\WorkflowBundle\\Model\\ContextAccessor');
     $this->mailboxProcessStorage = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Mailbox\\MailboxProcessStorage')->disableOriginalConstructor()->getMock();
     $demoProcess = $this->getMock('Oro\\Bundle\\EmailBundle\\Mailbox\\MailboxProcessProviderInterface');
     $demoProcess->expects($this->any())->method('getSettingsEntityFQCN')->will($this->returnValue('DemoProcessSettings'));
     $this->mailboxProcessStorage->expects($this->any())->method('getProcess')->with($this->equalTo('demo'))->will($this->returnValue($demoProcess));
     $this->registry = $this->getMockBuilder('Doctrine\\Bundle\\DoctrineBundle\\Registry')->disableOriginalConstructor()->getMock();
     $this->repository = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Entity\\Repository\\MailboxRepository')->disableOriginalConstructor()->getMock();
     $this->registry->expects($this->any())->method('getRepository')->with($this->equalTo('OroEmailBundle:Mailbox'))->will($this->returnValue($this->repository));
     $this->action = new RequestMailboxes($this->contextAccessor, $this->registry, $this->mailboxProcessStorage);
     $this->action->setDispatcher($this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'));
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function getOrganization($activityEntity)
 {
     /**
      * @var $activityEntity Email
      * @var $emailAddressOwner EmailOwnerInterface
      */
     $emailAddressOwner = $activityEntity->getFromEmailAddress()->getOwner();
     if ($emailAddressOwner && $emailAddressOwner->getOrganization()) {
         return $emailAddressOwner->getOrganization();
     }
     /** @var SecurityContextInterface $securityContext */
     $securityContext = $this->securityContextLink->getService();
     $token = $securityContext->getToken();
     if ($token instanceof OrganizationContextTokenInterface) {
         return $token->getOrganizationContext();
     }
     $processes = $this->mailboxProcessStorage->getProcesses();
     foreach ($processes as $process) {
         $settingsClass = $process->getSettingsEntityFQCN();
         $mailboxes = $this->doctrineRegistryLink->getService()->getRepository('OroEmailBundle:Mailbox')->findBySettingsClassAndEmail($settingsClass, $activityEntity);
         foreach ($mailboxes as $mailbox) {
             return $mailbox->getOrganization();
         }
     }
     return null;
 }
コード例 #4
0
ファイル: MailboxType.php プロジェクト: antrampa/platform
 /**
  * Adds mailbox process form field of proper type
  *
  * @param FormInterface $form
  * @param string|null   $processType
  */
 protected function addProcessField(FormInterface $form, $processType)
 {
     if (!empty($processType)) {
         $process = $this->storage->getProcess($processType);
         if ($process->isEnabled()) {
             $form->add('processSettings', $this->storage->getProcess($processType)->getSettingsFormType(), ['required' => true]);
             return;
         }
     }
     $form->add('processSettings', 'hidden', ['data' => null]);
 }
コード例 #5
0
ファイル: MailboxHandler.php プロジェクト: Maksold/platform
 /**
  * Processing of form reload.
  */
 protected function processReload()
 {
     $this->form->handleRequest($this->request);
     $type = $this->form->get('processType')->getViewData();
     /** @var Mailbox $data */
     $data = $this->form->getData();
     if (!empty($type)) {
         $processorEntity = $this->mailboxProcessStorage->getNewSettingsEntity($type);
         $data->setProcessSettings($processorEntity);
     } else {
         $data->setProcessSettings(null);
     }
     $this->form = $this->formFactory->create(self::FORM, $data);
 }
コード例 #6
0
ファイル: EmailExtension.php プロジェクト: hugeval/platform
 /**
  * @param string $type
  *
  * @return string
  */
 public function getMailboxProcessLabel($type)
 {
     return $this->mailboxProcessStorage->getProcess($type)->getLabel();
 }