/**
  * @param string $id Product id
  *
  * @throws NotFoundHttpException If product is not found or the user cannot see it
  *
  * @return JsonResponse
  */
 public function getAction($id)
 {
     $product = $this->findProductOr404($id);
     $this->productBuilder->addMissingAssociations($product);
     $channels = array_keys($this->userContext->getChannelChoicesWithUserChannel());
     $locales = $this->userContext->getUserLocaleCodes();
     return new JsonResponse($this->normalizer->normalize($product, 'internal_api', ['locales' => $locales, 'channels' => $channels, 'filter_type' => 'pim.internal_api.product_value.view']));
 }
 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $scopeChoices = $this->userContext->getChannelChoicesWithUserChannel();
     $resolver->setDefaults(['field_type' => 'choice', 'field_options' => ['choices' => $scopeChoices]]);
 }
 /**
  * {@inheritdoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $scopeChoices = $this->userContext->getChannelChoicesWithUserChannel();
     $resolver->setDefaults(array('field_type' => 'choice', 'field_options' => array('choices' => $scopeChoices)));
 }
 /**
  * Build context for normalizer
  *
  * @return array
  */
 protected function buildContext()
 {
     $channels = array_keys($this->userContext->getChannelChoicesWithUserChannel());
     $locales = $this->userContext->getUserLocaleCodes();
     return ['locales' => $locales, 'channels' => $channels, 'filter_type' => 'pim.internal_api.product_value.view', 'locale' => $this->userContext->getUiLocale()->getCode(), 'disable_grouping_separator' => true];
 }