private function configureChannel(ChannelInterface $channel, $localeCodes = null, $currencyCodes = null, $shippingMethodNames = null, $paymentMethodNames = null, $taxonomyNames = null) { if ($shippingMethodNames) { $shippingMethodNames = array_map('trim', explode(',', $shippingMethodNames)); foreach ($shippingMethodNames as $shippingMethodName) { $shippingMethod = $shippingMethods = $this->getRepository('shipping_method')->findOneBy(array('name' => $shippingMethodName)); $channel->addShippingMethod($shippingMethod); } } if ($paymentMethodNames) { $paymentMethodNames = array_map('trim', explode(',', $paymentMethodNames)); $paymentMethods = $this->getRepository('payment_method')->findBy(array('name' => $paymentMethodNames)); foreach ($paymentMethods as $paymentMethod) { $channel->addPaymentMethod($paymentMethod); } } if ($localeCodes) { $localeCodes = array_map('trim', explode(',', $localeCodes)); $locales = $this->getRepository('locale')->findBy(array('code' => $localeCodes)); foreach ($locales as $locale) { $channel->addLocale($locale); } } if ($currencyCodes) { $currencyCodes = array_map('trim', explode(',', $currencyCodes)); $currencies = $this->getRepository('currency')->findBy(array('code' => $currencyCodes)); foreach ($currencies as $currency) { $channel->addCurrency($currency); } } if ($taxonomyNames) { $taxonomyNames = array_map('trim', explode(',', $taxonomyNames)); foreach ($taxonomyNames as $taxonomyName) { $taxonomy = $this->getRepository('taxonomy')->findOneBy(array('name' => $taxonomyName)); $channel->addTaxonomy($taxonomy); } } }
/** * @Given /^(it) uses the "([^"]+)" locale by default$/ */ public function itUsesTheLocaleByDefault(ChannelInterface $channel, $localeName) { $locale = $this->provideLocale($this->localeConverter->convertNameToCode($localeName)); $this->localeManager->flush(); $channel->addLocale($locale); $channel->setDefaultLocale($locale); $this->channelManager->flush(); }