/**
  * @ 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());
 }
コード例 #2
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);
     }
 }
 /**
  * @param StaticSegment $value
  * @param UniqueStaticSegmentNameConstraint|Constraint $constraint
  */
 public function validate($value, Constraint $constraint)
 {
     if ($value instanceof StaticSegment && !$value->getOriginId()) {
         $this->transport->init($value->getChannel()->getTransport());
         $segments = $this->transport->getListStaticSegments($value->getSubscribersList());
         foreach ($segments as $segment) {
             if ($segment['name'] == $value->getName()) {
                 $this->context->addViolationAt('name', $constraint->message);
                 break;
             }
         }
     }
 }