function it_fails_if_no_channel_has_been_found($context, $channelManager, AbstractProductProcessor $value, HasValidDefaultLocale $constraint, Channel $channel)
 {
     $value->getChannel()->willReturn('channel');
     $channelManager->getChannelByCode('channel')->willReturn(false);
     $constraint->message = 'The given default locale is not valid (check that the selected locale is in channel\'s locales)';
     $context->addViolationAt('defaultLocale', 'The given default locale is not valid (check that the selected locale is in channel\'s locales)', ['defaultLocale'])->shouldBeCalled();
     $this->validate($value, $constraint);
 }
 /**
  * Checks if the passed value is valid.
  *
  * @param AbstractProductProcessor $value      The value that should be validated
  * @param Constraint               $constraint The constraint for the validation
  *
  * @api
  */
 public function validate($value, Constraint $constraint)
 {
     if (!$value instanceof AbstractProductProcessor) {
         return null;
     }
     if ($channel = $this->channelManager->getChannelByCode($value->getChannel())) {
         foreach ($channel->getLocales() as $locale) {
             if ($locale->getCode() === $value->getDefaultLocale()) {
                 return null;
             }
         }
     }
     $this->context->addViolationAt('defaultLocale', $constraint->message, ['defaultLocale']);
 }
 /**
  * Checks if the passed value is valid.
  *
  * @param AbstractProductProcessor $value      The value that should be validated
  * @param Constraint               $constraint The constraint for the validation
  *
  * @api
  */
 public function validate($value, Constraint $constraint)
 {
     if (!$value instanceof AbstractProductProcessor) {
         return null;
     }
     if ($channel = $this->channelManager->getChannelByCode($value->getChannel())) {
         foreach ($channel->getCurrencies() as $currency) {
             if ($currency->getCode() === $value->getCurrency()) {
                 return null;
             }
         }
     }
     $this->context->addViolationAt('currency', $constraint->message, ['currency']);
 }
 /**
  * Function called before all process
  */
 protected function beforeExecute()
 {
     parent::beforeExecute();
     $priceMappingManager = new PriceMappingManager($this->defaultLocale, $this->currency);
     $this->configurableNormalizer = $this->normalizerGuesser->getConfigurableNormalizer($this->getClientParameters(), $this->productNormalizer, $priceMappingManager);
 }
 /**
  * {@inheritdoc}
  */
 public function getConfigurationFields()
 {
     return array_merge(parent::getConfigurationFields(), ['pimGrouped' => ['type' => 'choice', 'options' => ['choices' => $this->associationTypeManager->getAssociationTypeChoices(), 'help' => 'pim_magento_connector.export.pimGrouped.help', 'label' => 'pim_magento_connector.export.pimGrouped.label', 'attr' => ['class' => 'select2']]]]);
 }
 /**
  * {@inheritdoc}
  */
 public function getConfigurationFields()
 {
     return array_merge(parent::getConfigurationFields(), ['smallImageAttribute' => ['type' => 'choice', 'options' => ['choices' => $this->attributeManager->getImageAttributeChoice(), 'help' => 'pim_magento_connector.export.smallImageAttribute.help', 'label' => 'pim_magento_connector.export.smallImageAttribute.label', 'attr' => ['class' => 'select2']]], 'baseImageAttribute' => ['type' => 'choice', 'options' => ['choices' => $this->attributeManager->getImageAttributeChoice(), 'help' => 'pim_magento_connector.export.baseImageAttribute.help', 'label' => 'pim_magento_connector.export.baseImageAttribute.label', 'attr' => ['class' => 'select2']]], 'thumbnailAttribute' => ['type' => 'choice', 'options' => ['choices' => $this->attributeManager->getImageAttributeChoice(), 'help' => 'pim_magento_connector.export.thumbnailAttribute.help', 'label' => 'pim_magento_connector.export.thumbnailAttribute.label', 'attr' => ['class' => 'select2']]], 'pimGrouped' => ['type' => 'choice', 'options' => ['choices' => $this->associationTypeManager->getAssociationTypeChoices(), 'help' => 'pim_magento_connector.export.pimGrouped.help', 'label' => 'pim_magento_connector.export.pimGrouped.label', 'attr' => ['class' => 'select2']]]]);
 }