/**
  * @return Channel
  */
 protected function getChannel()
 {
     if ($this->channel === null || $this->context->getOption('channel') !== $this->channel->getId()) {
         $this->channel = $this->connectorContextMediator->getChannel($this->context);
     }
     return $this->channel;
 }
 /**
  * @ TransportInterface $transport
  */
 public function initFromContext()
 {
     $this->transport = $this->contextMediator->getTransport($this->getContext(), true);
     $this->channel = $this->contextMediator->getChannel($this->getContext());
     if (!$this->transport) {
         throw new \InvalidArgumentException('Transport was not provided');
     }
     $this->transport->init($this->channel->getTransport());
 }
 public function testGetChannelFromContext()
 {
     $testID = 1;
     $integration = new Integration();
     $integration->setTransport($this->getMockForAbstractClass('Oro\\Bundle\\IntegrationBundle\\Entity\\Transport'));
     $context = $this->getMock('Oro\\Bundle\\ImportExportBundle\\Context\\ContextInterface');
     $context->expects($this->once())->method('getOption')->with('channel')->will($this->returnValue($testID));
     $this->repo->expects($this->once())->method('getOrLoadById')->with($testID)->will($this->returnValue($integration));
     $result = $this->contextMediator->getChannel($context);
     $this->assertEquals($integration, $result);
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 protected function initializeFromContext(ContextInterface $context)
 {
     $this->transport = $this->contextMediator->getTransport($context, true);
     $this->channel = $this->contextMediator->getChannel($context);
     $this->validateConfiguration();
     $this->transport->init($this->channel->getTransport());
     $this->setSourceIterator($this->getConnectorSource());
     if ($this->getSourceIterator() instanceof LoggerAwareInterface) {
         $this->getSourceIterator()->setLogger($this->logger);
     }
 }
Ejemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 protected function initializeFromContext(ContextInterface $context)
 {
     $this->channel = $this->contextMediator->getChannel($context);
     $this->transport = $this->contextMediator->getInitializedTransport($this->channel, true);
     // info was loaded from index action
     if ($this->transport->isSupportedExtensionVersion()) {
         return;
     }
     $entitiesIds = (array) $this->stepExecution->getJobExecution()->getExecutionContext()->get($this->contextKey);
     if (!$entitiesIds) {
         return;
     }
     sort($entitiesIds);
     $this->ids = array_unique(array_filter($entitiesIds));
 }