/** * {@inheritdoc} */ public function finishView(FormView $view, FormInterface $form, array $options) { $values = null !== $view->vars['value'] ? $view->vars['value']->getValues() : []; $view->vars['groups'] = $this->productFormView->getView(); $view->vars['orderedGroups'] = $this->getOrderedGroups($values); $view->vars['locales'] = $this->userContext->getUserLocales(); $view->vars['channels'] = $this->channelManager->getChannels(); $view->vars['currentLocale'] = $options['currentLocale']; }
/** * Edit a family * * TODO : find a way to use param converter with interfaces * * @param Family $family * * @Template * @AclAncestor("pim_enrich_family_index") * * @return array */ public function editAction(Family $family) { if ($this->familyHandler->process($family)) { $this->addFlash('success', 'flash.family.updated'); } return ['form' => $this->familyForm->createView(), 'attributesForm' => $this->getAvailableAttributesForm($family->getAttributes()->toArray())->createView(), 'channels' => $this->channelManager->getChannels()]; }
/** * Test related method */ public function testGetChannels() { $channels = $this->manager->getChannels(); $this->assertCount(2, $channels); $this->assertEquals($this->channel1, reset($channels)); $this->assertEquals($this->channel2, end($channels)); }
/** * 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->channelManager->getChannels()]; }
/** * Return rows for available channels and theirs locales * * @param AbstractAttribute $attribute * * @return array */ protected function getScopeToLocaleRows(AbstractAttribute $attribute) { $channels = $this->channelManager->getChannels(); $scopeToLocaleRows = array(); foreach ($channels as $channel) { foreach ($channel->getLocales() as $locale) { $scopeToLocaleRows[] = array('attribute' => $attribute->getCode(), 'locale' => $locale->getCode(), 'scope' => $channel->getCode()); } } return $scopeToLocaleRows; }
function let(SecurityContextInterface $securityContext, LocaleManager $localeManager, ChannelManager $channelManager, CategoryManager $categoryManager, TokenInterface $token, User $user, LocaleInterface $en, LocaleInterface $fr, LocaleInterface $de, ChannelInterface $ecommerce, ChannelInterface $mobile, CategoryInterface $firstTree, CategoryInterface $secondTree) { $securityContext->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); $localeManager->getLocaleByCode('en_US')->willReturn($en); $localeManager->getLocaleByCode('fr_FR')->willReturn($fr); $localeManager->getLocaleByCode('de_DE')->willReturn($de); $localeManager->getActiveLocales()->willReturn([$en, $fr, $de]); $channelManager->getChannels()->willReturn([$mobile, $ecommerce]); $categoryManager->getTrees()->willReturn([$firstTree, $secondTree]); $this->beConstructedWith($securityContext, $localeManager, $channelManager, $categoryManager, 'en_US'); }
/** * @param ChannelManager $channelManager */ public function __construct(ChannelManager $channelManager) { $this->channels = $channelManager->getChannels(); }
/** * Get user channel * * @return Channel */ public function getUserChannel() { $catalogScope = $this->getUserOption('catalogScope'); return $catalogScope ?: current($this->channelManager->getChannels()); }
/** * Get the PIM channels * * @return \Pim\Bundle\CatalogBundle\Entity\Channel[] */ protected function getChannels() { return $this->channelManager->getChannels(); }