/**
  * Get the list of all locales
  *
  * @return JsonResponse all activated locales
  */
 public function indexAction()
 {
     $locales = $this->localeRepository->getActivatedLocales();
     $filteredLocales = $this->collectionFilter->filterCollection($locales, 'pim.internal_api.locale.view');
     $normalizedLocales = $this->normalizer->normalize($filteredLocales, 'internal_api');
     return new JsonResponse($normalizedLocales);
 }
 /**
  * @return LocaleInterface[]
  */
 protected function getLocales()
 {
     if (null === $this->locales) {
         $this->locales = $this->localeRepository->getActivatedLocales();
     }
     return $this->locales;
 }
 /**
  * Returns active locales
  *
  * @return LocaleInterface[]
  */
 public function getUserLocales()
 {
     if ($this->userLocales === null) {
         $this->userLocales = $this->localeRepository->getActivatedLocales();
     }
     return $this->userLocales;
 }
 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');
 }
 /**
  * Get active locales
  *
  * @return \Pim\Bundle\CatalogBundle\Entity\Locale[]
  */
 public function getActiveLocales()
 {
     return $this->repository->getActivatedLocales();
 }