コード例 #1
0
 function let(DocumentManager $manager, ChannelInterface $ecommerce, ChannelInterface $mobile, LocaleInterface $enUs, LocaleInterface $frFr, CategoryInterface $category, ChannelRepositoryInterface $channelRepository, CategoryRepositoryInterface $categoryRepository, ProductRepository $productRepository, QueryBuilder $ormQb, Builder $odmQb, Query $odmQuery, OrmQuery $ormQuery, Cursor $cursor)
 {
     $enUs->getCode()->willReturn('en_US');
     $frFr->getCode()->willReturn('fr_FR');
     $ecommerce->getCode()->willReturn('ecommerce');
     $ecommerce->getLabel()->willReturn('ECommerce');
     $ecommerce->getLocales()->willReturn([$enUs, $frFr]);
     $ecommerce->getCategory()->willReturn($category);
     $mobile->getCode()->willReturn('mobile');
     $mobile->getLabel()->willReturn('Mobile');
     $mobile->getLocales()->willReturn([$enUs]);
     $mobile->getCategory()->willReturn($category);
     $odmQuery->execute()->willReturn($cursor);
     $productRepository->createQueryBuilder()->willReturn($odmQb);
     $odmQb->hydrate(Argument::any())->willReturn($odmQb);
     $odmQb->field(Argument::any())->willReturn($odmQb);
     $odmQb->in(Argument::any())->willReturn($odmQb);
     $odmQb->equals(Argument::any())->willReturn($odmQb);
     $odmQb->select('_id')->willReturn($odmQb);
     $odmQb->getQuery()->willReturn($odmQuery);
     $categoryRepository->getAllChildrenIds($category, true)->willReturn([1, 2, 3]);
     $channelRepository->findAll()->willReturn([$ecommerce, $mobile]);
     $manager->getRepository('pim_product_class')->willReturn($productRepository);
     $this->beConstructedWith($manager, $channelRepository, $categoryRepository, 'pim_product_class');
 }
コード例 #2
0
 /**
  * Displays completeness for a product
  *
  * @param int $id
  *
  * @return Response
  */
 public function completenessAction($id)
 {
     $product = $this->productRepository->getFullProduct($id);
     $channels = $this->channelRepository->getFullChannels();
     $locales = $this->userContext->getUserLocales();
     $completenesses = $this->completenessManager->getProductCompleteness($product, $channels, $locales, $this->userContext->getCurrentLocale()->getCode());
     return $this->templating->renderResponse('PimEnrichBundle:Completeness:_completeness.html.twig', ['product' => $product, 'channels' => $channels, 'locales' => $locales, 'completenesses' => $completenesses]);
 }
コード例 #3
0
 function it_provides_channel_choices(ObjectManager $objectManager, ChannelRepositoryInterface $repository, ChannelInterface $mobile, ChannelInterface $ecommerce)
 {
     $repository->findBy(array())->willReturn(array($mobile, $ecommerce));
     $mobile->getCode()->willReturn('mobile');
     $mobile->getLabel()->willReturn('Mobile');
     $ecommerce->getCode()->willReturn('ecommerce');
     $ecommerce->getLabel()->willReturn('Ecommerce');
     $this->getChannelChoices()->shouldReturn(['mobile' => 'Mobile', 'ecommerce' => 'Ecommerce']);
 }
コード例 #4
0
 function it_provides_default_values($decoratedProvider, ChannelRepositoryInterface $channelRepository, LocaleRepositoryInterface $localeRepository, LocaleInterface $locale, ChannelInterface $channel)
 {
     $channel->getCode()->willReturn('channel_code');
     $channelRepository->getFullChannels()->willReturn([$channel]);
     $locale->getCode()->willReturn('locale_code');
     $localeRepository->getActivatedLocaleCodes()->willReturn([$locale]);
     $decoratedProvider->getDefaultValues()->willReturn(['decoratedParam' => true]);
     $this->getDefaultValues()->shouldReturnWellFormedDefaultValues();
 }
コード例 #5
0
 /**
  * {@inheritdoc}
  */
 public function validate($value, Constraint $constraint)
 {
     $channels = $this->channelRepository->getLabelsIndexedByCode();
     if (0 === count($channels)) {
         throw new ConstraintDefinitionException('No channel is set in the application');
     }
     $constraint->choices = array_keys($channels);
     parent::validate($value, $constraint);
 }
コード例 #6
0
 /**
  * Pre remove
  *
  * @param GenericEvent $event
  */
 public function checkChannelLink(GenericEvent $event)
 {
     $object = $event->getSubject();
     if (!$object instanceof CurrencyInterface) {
         return;
     }
     if (!$object->isActivated() && 0 < $this->channelRepository->getChannelCountUsingCurrency($object)) {
         throw new LinkedChannelException('You cannot disable a currency linked to a channel.');
     }
 }
コード例 #7
0
 /**
  * {@inheritdoc}
  */
 public function process($family)
 {
     $actions = $this->getConfiguredActions();
     foreach ($actions as $action) {
         $attribute = $this->attributeRepository->findOneByIdentifier($action['attribute_code']);
         $channel = $this->channelRepository->findOneByIdentifier($action['channel_code']);
         $isRequired = $action['is_required'];
         $family->addAttribute($attribute);
         $family->addAttributeRequirement($this->factory->createAttributeRequirement($attribute, $channel, $isRequired));
     }
     return $family;
 }
コード例 #8
0
 /**
  * {@inheritdoc}
  */
 public function getDefaultValues()
 {
     $parameters = $this->simpleProvider->getDefaultValues();
     $parameters['decimalSeparator'] = LocalizerInterface::DEFAULT_DECIMAL_SEPARATOR;
     $parameters['dateFormat'] = LocalizerInterface::DEFAULT_DATE_FORMAT;
     $parameters['with_media'] = true;
     $parameters['filePath'] = sys_get_temp_dir() . 'csv_products_export.csv';
     $defaultChannel = $this->channelRepository->getFullChannels()[0];
     $defaultLocaleCode = $this->localeRepository->getActivatedLocaleCodes()[0];
     $parameters['filters'] = ['data' => [['field' => 'enabled', 'operator' => OPERATORS::EQUALS, 'value' => true], ['field' => 'completeness', 'operator' => OPERATORS::GREATER_OR_EQUAL_THAN, 'value' => 100], ['field' => 'categories.code', 'operator' => OPERATORS::IN_CHILDREN_LIST, 'value' => []]], 'structure' => ['scope' => $defaultChannel->getCode(), 'locales' => [$defaultLocaleCode]]];
     return $parameters;
 }
コード例 #9
0
 /**
  * Get completeness for a product
  *
  * @param int $id
  *
  * @return JSONResponse
  */
 public function getAction($id)
 {
     $product = $this->productRepository->getFullProduct($id);
     if (null === $product->getFamily()) {
         return new JsonResponse();
     }
     $this->completenessManager->generateMissingForProduct($product);
     $channels = $this->channelRepository->getFullChannels();
     $locales = $this->userContext->getUserLocales();
     $filteredLocales = $this->collectionFilter->filterCollection($locales, 'pim.internal_api.locale.view');
     $completenesses = $this->completenessManager->getProductCompleteness($product, $channels, $filteredLocales, $this->userContext->getCurrentLocale()->getCode());
     return new JsonResponse($this->completenessNormalizer->normalize($completenesses, 'internal_api'));
 }
コード例 #10
0
 /**
  * @param FamilyInterface $family
  *
  * @return string[]
  */
 protected function getMissingChannelCodes(FamilyInterface $family)
 {
     $requirements = $family->getAttributeRequirements();
     $identifierCode = $this->attributeRepository->getIdentifierCode();
     $currentChannelCodes = [];
     foreach ($requirements as $requirement) {
         if ($requirement->getAttributeCode() === $identifierCode) {
             $currentChannelCodes[] = $requirement->getChannelCode();
         }
     }
     $expectedChannelCodes = $this->channelRepository->getChannelCodes();
     $missingChannelCodes = array_diff($expectedChannelCodes, $currentChannelCodes);
     return $missingChannelCodes;
 }
コード例 #11
0
 /**
  * @return ChannelInterface[]
  */
 protected function getChannels()
 {
     if (null === $this->channels) {
         $this->channels = $this->channelRepository->findAll();
     }
     return $this->channels;
 }
コード例 #12
0
 /**
  * @param string $code
  *
  * @return ChannelInterface
  */
 protected function getChannel($code)
 {
     if (!array_key_exists($code, $this->channels)) {
         $this->channels[$code] = $this->channelRepository->findOneByIdentifier($code);
     }
     return $this->channels[$code];
 }
コード例 #13
0
 /**
  * {@inheritdoc}
  */
 public function process($family)
 {
     $configuration = $this->getJobConfiguration();
     if (!array_key_exists('actions', $configuration)) {
         throw new InvalidArgumentException('Missing configuration for \'actions\'.');
     }
     $actions = $configuration['actions'];
     foreach ($actions as $action) {
         $attribute = $this->attributeRepository->findOneByIdentifier($action['attribute_code']);
         $channel = $this->channelRepository->findOneByIdentifier($action['channel_code']);
         $isRequired = $action['is_required'];
         $family->addAttribute($attribute);
         $family->addAttributeRequirement($this->factory->createAttributeRequirement($attribute, $channel, $isRequired));
     }
     return $family;
 }
コード例 #14
0
 /**
  * @param string $code
  *
  * @throws ObjectNotFoundException
  *
  * @return ChannelInterface
  */
 protected function getChannelByCode($code)
 {
     $channel = $this->channelRepository->findOneByIdentifier($code);
     if (null === $channel) {
         throw new ObjectNotFoundException(sprintf('Channel with "%s" code does not exist', $code));
     }
     return $channel;
 }
コード例 #15
0
 /**
  * Get completeness for a product
  *
  * @param int|string $id
  *
  * @return JSONResponse
  */
 public function getAction($id)
 {
     $product = $this->productRepository->getFullProduct($id);
     if (null === $product->getFamily()) {
         return new JsonResponse();
     }
     $this->completenessManager->generateMissingForProduct($product);
     // Product have to be refreshed to have the completeness values generated by generateMissingForProduct()
     // (on ORM, completeness is not calculated the same way and product doesn't need to be refreshed)
     if (AkeneoStorageUtilsExtension::DOCTRINE_MONGODB_ODM === $this->storageDriver) {
         $this->productManager->refresh($product);
     }
     $channels = $this->channelRepository->getFullChannels();
     $locales = $this->userContext->getUserLocales();
     $filteredLocales = $this->collectionFilter->filterCollection($locales, 'pim.internal_api.locale.view');
     $completenesses = $this->completenessManager->getProductCompleteness($product, $channels, $filteredLocales);
     return new JsonResponse($this->compNormalizer->normalize($completenesses, 'internal_api'));
 }
コード例 #16
0
 function let(TokenStorageInterface $tokenStorage, LocaleRepositoryInterface $localeRepository, ChannelRepositoryInterface $channelRepository, TokenInterface $token, User $user, LocaleInterface $en, LocaleInterface $fr, LocaleInterface $de, ChannelInterface $ecommerce, ChannelInterface $mobile, CategoryInterface $firstTree, CategoryInterface $secondTree, CategoryRepositoryInterface $productCategoryRepo, RequestStack $requestStack, ChoicesBuilderInterface $choicesBuilder)
 {
     $tokenStorage->getToken()->willReturn($token);
     $token->getUser()->willReturn($user);
     $en->getCode()->willReturn('en_US');
     $fr->getCode()->willReturn('fr_FR');
     $de->getCode()->willReturn('de_DE');
     $en->isActivated()->willReturn(true);
     $fr->isActivated()->willReturn(true);
     $de->isActivated()->willReturn(true);
     $localeRepository->findOneByIdentifier('en_US')->willReturn($en);
     $localeRepository->findOneByIdentifier('fr_FR')->willReturn($fr);
     $localeRepository->findOneByIdentifier('de_DE')->willReturn($de);
     $localeRepository->getActivatedLocales()->willReturn([$en, $fr, $de]);
     $channelRepository->findOneBy([])->willReturn($mobile);
     $productCategoryRepo->getTrees()->willReturn([$firstTree, $secondTree]);
     $this->beConstructedWith($tokenStorage, $localeRepository, $channelRepository, $productCategoryRepo, $requestStack, $choicesBuilder, 'en_US');
 }
コード例 #17
0
 /**
  * {@inheritdoc}
  */
 public function initialize()
 {
     $this->channels = $this->channelRepository->findAll();
     foreach ($this->attributeRepository->getNonIdentifierAttributes() as $attribute) {
         $this->attributes[(string) $attribute->getGroup()][] = $attribute;
         foreach ($this->channels as $channel) {
             $this->addAttributeRequirement($this->factory->createAttributeRequirement($attribute, $channel, false));
         }
     }
 }
コード例 #18
0
 /**
  * Check the consistency of the field with channel associated
  *
  * @param AttributeInterface $attribute
  * @param string             $fieldName
  * @param array              $attributeInfo
  *
  * @throws \InvalidArgumentException
  */
 protected function checkFieldNameLocaleByChannel(AttributeInterface $attribute, $fieldName, array $attributeInfo)
 {
     if ($attribute->isScopable() && $attribute->isLocalizable() && isset($attributeInfo['scope_code']) && isset($attributeInfo['locale_code'])) {
         $channel = $this->channelRepository->findOneByIdentifier($attributeInfo['scope_code']);
         $locale = $this->localeRepository->findOneByIdentifier($attributeInfo['locale_code']);
         if ($channel !== null && $locale !== null && !$channel->hasLocale($locale)) {
             throw new \InvalidArgumentException(sprintf('The locale "%s" of the field "%s" is not available in scope "%s"', $attributeInfo['locale_code'], $fieldName, $attributeInfo['scope_code']));
         }
     }
 }
コード例 #19
0
 /**
  * Get channel choices with user channel code first
  *
  * @return string[]
  */
 public function getChannelChoicesWithUserChannel()
 {
     $channels = $this->channelRepository->findAll();
     $channelChoices = $this->choicesBuilder->buildChoices($channels);
     $userChannelCode = $this->getUserChannelCode();
     if (array_key_exists($userChannelCode, $channelChoices)) {
         return [$userChannelCode => $channelChoices[$userChannelCode]] + $channelChoices;
     }
     return $channelChoices;
 }
コード例 #20
0
 function it_initializes_attribute_requirements_with_all_channels_and_attributes_in_the_PIM(ChannelRepositoryInterface $channelRepository, ChannelInterface $ecommerceChannel, ChannelInterface $mobileChannel, AttributeRepositoryInterface $attributeRepository, AttributeInterface $nameAttribute, AttributeInterface $descriptionAttribute, AttributeRequirementFactory $factory, AttributeRequirementInterface $nameECommerceRequirement, AttributeRequirementInterface $nameMobileRequirement, AttributeRequirementInterface $descriptionECommerceRequirement, AttributeRequirementInterface $descriptionMobileRequirement)
 {
     $channelRepository->findAll()->willReturn([$ecommerceChannel, $mobileChannel]);
     $attributeRepository->getNonIdentifierAttributes()->willReturn([$nameAttribute, $descriptionAttribute]);
     $factory->createAttributeRequirement($nameAttribute, $ecommerceChannel, false)->willReturn($nameECommerceRequirement);
     $nameECommerceRequirement->getAttributeCode()->willReturn('name');
     $nameECommerceRequirement->getChannelCode()->willReturn('ecommerce');
     $factory->createAttributeRequirement($nameAttribute, $mobileChannel, false)->willReturn($nameMobileRequirement);
     $nameMobileRequirement->getAttributeCode()->willReturn('name');
     $nameMobileRequirement->getChannelCode()->willReturn('mobile');
     $factory->createAttributeRequirement($descriptionAttribute, $ecommerceChannel, false)->willReturn($descriptionECommerceRequirement);
     $descriptionECommerceRequirement->getAttributeCode()->willReturn('description');
     $descriptionECommerceRequirement->getChannelCode()->willReturn('ecommerce');
     $factory->createAttributeRequirement($descriptionAttribute, $mobileChannel, false)->willReturn($descriptionMobileRequirement);
     $descriptionMobileRequirement->getAttributeCode()->willReturn('description');
     $descriptionMobileRequirement->getChannelCode()->willReturn('mobile');
     $this->initialize();
     $this->getAttributeRequirements()->toArray()->shouldReturn(['name_ecommerce' => $nameECommerceRequirement, 'name_mobile' => $nameMobileRequirement, 'description_ecommerce' => $descriptionECommerceRequirement, 'description_mobile' => $descriptionMobileRequirement]);
 }
コード例 #21
0
 /**
  * {@inheritdoc}
  */
 public function getCompleteProductsCountPerChannels()
 {
     $channels = $this->channelRepository->findAll();
     $productRepo = $this->documentManager->getRepository($this->productClass);
     $productsCount = [];
     foreach ($channels as $channel) {
         $category = $channel->getCategory();
         $categoryIds = $this->categoryRepository->getAllChildrenIds($category, true);
         foreach ($channel->getLocales() as $locale) {
             $data = [];
             $compSuffix = $channel->getCode() . '-' . $locale->getCode();
             $localeCount = $productRepo->createQueryBuilder()->hydrate(false)->field('categoryIds')->in($categoryIds)->field('enabled')->equals(true)->field('normalizedData.completenesses.' . $compSuffix)->equals(100)->select('_id')->getQuery()->execute()->count();
             $data['locale'] = $locale->getCode();
             $data['label'] = $channel->getLabel();
             $data['total'] = $localeCount;
             $productsCount[] = $data;
         }
     }
     return $productsCount;
 }
コード例 #22
0
 /**
  * {@inheritdoc}
  */
 public function validate($value, Constraint $constraint)
 {
     if (null === $value['scope'] || null === $value['locales']) {
         return;
     }
     $filterStructureScope = $value['scope'];
     $filterStructureLocales = $value['locales'];
     $scope = $this->channelRepository->findOneByIdentifier($filterStructureScope);
     $localesCodes = [];
     if (null !== $scope) {
         $localesCodes = $scope->getLocaleCodes();
     }
     $errorCount = 0;
     foreach ($filterStructureLocales as $localeCode) {
         if (!in_array($localeCode, $localesCodes)) {
             $this->context->buildViolation($constraint->message)->setParameter('%localeCode%', $localeCode)->atPath(sprintf('[locales][%d]', $errorCount))->addViolation();
             $errorCount++;
         }
     }
 }
コード例 #23
0
 /**
  * Edit a family
  *
  * @param int $id
  *
  * @Template
  * @AclAncestor("pim_enrich_family_index")
  *
  * @return array
  */
 public function editAction($id)
 {
     $family = $this->familyRepository->find($id);
     if (null === $family) {
         throw new NotFoundHttpException(sprintf('%s entity not found', $this->familyClass));
     }
     if ($this->familyHandler->process($family)) {
         $this->request->getSession()->getFlashBag()->add('success', new Message('flash.family.updated'));
     }
     return ['form' => $this->familyForm->createView(), 'attributesForm' => $this->getAvailableAttributesForm($family->getAttributes()->toArray())->createView(), 'channels' => $this->channelRepository->findAll()];
 }
コード例 #24
0
 /**
  * @param FamilyInterface    $family
  * @param AttributeInterface $attribute
  * @param string             $channelCode
  *
  * @return AttributeRequirementInterface
  */
 protected function createAttributeRequirement(FamilyInterface $family, AttributeInterface $attribute, $channelCode)
 {
     $channel = $this->channelRepository->findOneByIdentifier($channelCode);
     if (null === $channel) {
         throw new \InvalidArgumentException(sprintf('Channel with "%s" code does not exist', $channelCode));
     }
     $requirement = $this->requirementRepo->findOneBy(['attribute' => $attribute->getId(), 'channel' => $channel->getId(), 'family' => $family->getId()]);
     if (null === $requirement) {
         $requirement = $this->attrRequiFactory->createAttributeRequirement($attribute, $channel, true);
     }
     return $requirement;
 }
コード例 #25
0
 /**
  * Returns the configured channel from the parameters.
  * If no channel is specified, returns null.
  *
  * @throws ObjectNotFoundException
  *
  * @return ChannelInterface|null
  */
 protected function getConfiguredChannel()
 {
     $parameters = $this->stepExecution->getJobParameters();
     if (!isset($parameters->get('filters')['structure']['scope'])) {
         return null;
     }
     $channelCode = $parameters->get('filters')['structure']['scope'];
     $channel = $this->channelRepository->findOneByIdentifier($channelCode);
     if (null === $channel) {
         throw new ObjectNotFoundException(sprintf('Channel with "%s" code does not exist', $channelCode));
     }
     return $channel;
 }
コード例 #26
0
 /**
  * {@inheritdoc}
  */
 public function process($product)
 {
     $parameters = $this->stepExecution->getJobParameters();
     $structure = $parameters->get('filters')['structure'];
     $channel = $this->channelRepository->findOneByIdentifier($structure['scope']);
     $this->productBuilder->addMissingProductValues($product, [$channel], $channel->getLocales()->toArray());
     $productStandard = $this->normalizer->normalize($product, 'json', ['channels' => [$channel->getCode()], 'locales' => array_intersect($channel->getLocaleCodes(), $parameters->get('filters')['structure']['locales'])]);
     if ($this->areAttributesToFilter($parameters)) {
         $attributesToFilter = $this->getAttributesToFilter($parameters);
         $productStandard['values'] = $this->filterValues($productStandard['values'], $attributesToFilter);
     }
     if ($parameters->has('with_media') && $parameters->get('with_media')) {
         $directory = $this->stepExecution->getJobExecution()->getExecutionContext()->get(JobInterface::WORKING_DIRECTORY_PARAMETER);
         $this->fetchMedia($product, $directory);
     } else {
         $mediaAttributes = $this->attributeRepository->findMediaAttributeCodes();
         $productStandard['values'] = array_filter($productStandard['values'], function ($attributeCode) use($mediaAttributes) {
             return !in_array($attributeCode, $mediaAttributes);
         }, ARRAY_FILTER_USE_KEY);
     }
     $this->detacher->detach($product);
     return $productStandard;
 }
コード例 #27
0
 /**
  * Remove channel
  *
  * @param Request $request
  * @param Channel $channel
  *
  * @AclAncestor("pim_enrich_channel_remove")
  *
  * @return Response
  */
 public function removeAction(Request $request, Channel $channel)
 {
     // TODO This validation should be moved to a validator and that validation trigered by the remover
     $channelCount = $this->channelRepository->countAll();
     if ($channelCount <= 1) {
         throw new DeleteException($this->getTranslator()->trans('flash.channel.not removable'));
     }
     $this->channelRemover->remove($channel);
     if ($request->isXmlHttpRequest()) {
         return new Response('', 204);
     } else {
         return $this->redirect($this->generateUrl('pim_enrich_channel_index'));
     }
 }
コード例 #28
0
 /**
  * Generate a list of potential completeness value from existing channel
  * or from the provided channel
  *
  * @param ChannelInterface $channel
  *
  * @return array
  */
 protected function getChannelLocaleCombinations(ChannelInterface $channel = null)
 {
     $channels = [];
     $combinations = [];
     if (null !== $channel) {
         $channels = [$channel];
     } else {
         $channels = $this->channelRepository->getFullChannels();
     }
     foreach ($channels as $channel) {
         $locales = $channel->getLocales();
         foreach ($locales as $locale) {
             $combinations[] = $channel->getCode() . '-' . $locale->getCode();
         }
     }
     return $combinations;
 }
コード例 #29
0
 /**
  * @param AttributeInterface $attribute
  * @param array              $values
  *
  * @throws ObjectNotFoundException
  *
  * @return array
  */
 protected function getNewValuesData(AttributeInterface $attribute, array $values)
 {
     $newValues = [];
     foreach ($values as $value) {
         $acceptValue = true;
         if (null !== $value['locale']) {
             $isAuthorizedOnLocale = !$this->objectFilter->filterObject($this->getLocale($value['locale']), 'pim.internal_api.locale.edit');
             $isEditableOnLocale = $attribute->isLocaleSpecific() ? in_array($value['locale'], $attribute->getLocaleSpecificCodes()) : true;
             $acceptValue = $isAuthorizedOnLocale && $isEditableOnLocale;
         }
         if ($attribute->isScopable() && $acceptValue) {
             $channel = $this->channelRepository->findOneByIdentifier($value['scope']);
             if (null === $channel) {
                 $acceptValue = false;
             }
         }
         if ($acceptValue) {
             $newValues[] = $value;
         }
     }
     return $newValues;
 }
コード例 #30
0
 /**
  * Checks that attributes in the header have existing locale, scope and currency.
  *
  * @throws \LogicException
  */
 protected function checkAttributesInHeader()
 {
     $channels = $this->channelRepository->getChannelCodes();
     $locales = $this->localeRepository->getActivatedLocaleCodes();
     $currencies = $this->currencyRepository->getActivatedCurrencyCodes();
     foreach ($this->fieldNames as $fieldName) {
         if (null !== ($info = $this->fieldExtractor->extractColumnInfo($fieldName))) {
             $locale = $info['locale_code'];
             $channel = $info['scope_code'];
             $currency = isset($info['price_currency']) ? $info['price_currency'] : null;
             if (null !== $locale && !in_array($locale, $locales)) {
                 throw new \LogicException(sprintf('Locale %s does not exist.', $locale));
             }
             if (null !== $channel && !in_array($channel, $channels)) {
                 throw new \LogicException(sprintf('Channel %s does not exist.', $channel));
             }
             if (null !== $currency && !in_array($currency, $currencies)) {
                 throw new \LogicException(sprintf('Currency %s does not exist.', $currency));
             }
         }
     }
 }