當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SharedStorageInterface::has方法代碼示例

本文整理匯總了PHP中Sylius\Behat\Service\SharedStorageInterface::has方法的典型用法代碼示例。如果您正苦於以下問題:PHP SharedStorageInterface::has方法的具體用法?PHP SharedStorageInterface::has怎麽用?PHP SharedStorageInterface::has使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sylius\Behat\Service\SharedStorageInterface的用法示例。


在下文中一共展示了SharedStorageInterface::has方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createShippingMethod

 /**
  * @param string $name
  * @param string|null $code
  * @param int|null $position
  * @param ZoneInterface|null $zone
  * @param string $locale
  * @param array $configuration
  * @param string $calculator
  * @param bool $enabled
  * @param bool $addForCurrentChannel
  */
 private function createShippingMethod($name, $code = null, $position = null, ZoneInterface $zone = null, $locale = 'en', $configuration = ['amount' => 0], $calculator = DefaultCalculators::FLAT_RATE, $enabled = true, $addForCurrentChannel = true)
 {
     if (null === $zone) {
         $zone = $this->sharedStorage->get('zone');
     }
     if (null === $code) {
         $code = $this->generateCodeFromNameAndZone($name, $zone->getCode());
     }
     /** @var ShippingMethodInterface $shippingMethod */
     $shippingMethod = $this->shippingMethodFactory->createNew();
     $shippingMethod->setCode($code);
     $shippingMethod->setName($name);
     $shippingMethod->setPosition($position);
     $shippingMethod->setCurrentLocale($locale);
     $shippingMethod->setConfiguration($configuration);
     $shippingMethod->setCalculator($calculator);
     $shippingMethod->setZone($zone);
     $shippingMethod->setEnabled($enabled);
     if ($addForCurrentChannel && $this->sharedStorage->has('channel')) {
         $channel = $this->sharedStorage->get('channel');
         $channel->addShippingMethod($shippingMethod);
     }
     $this->shippingMethodRepository->add($shippingMethod);
     $this->sharedStorage->set('shipping_method', $shippingMethod);
 }
開發者ID:loic425,項目名稱:Sylius,代碼行數:36,代碼來源:ShippingContext.php

示例2: assertValidationMessage

 /**
  * @param string $element
  * @param string $message
  */
 private function assertValidationMessage($element, $message)
 {
     $product = $this->sharedStorage->has('product') ? $this->sharedStorage->get('product') : null;
     /** @var CreatePageInterface|UpdatePageInterface $currentPage */
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createSimpleProductPage, $this->createConfigurableProductPage, $this->updateSimpleProductPage, $this->updateConfigurableProductPage], $product);
     Assert::same($currentPage->getValidationMessage($element), $message);
 }
開發者ID:TheMadeleine,項目名稱:Sylius,代碼行數:11,代碼來源:ManagingProductsContext.php

示例3: storeHasAProductPricedAt

 /**
  * @Given the store has a product :productName
  * @Given the store has a :productName product
  * @Given /^the store(?:| also) has a product "([^"]+)" priced at ("[^"]+")$/
  */
 public function storeHasAProductPricedAt($productName, $price = 0)
 {
     $product = $this->createProduct($productName, $price);
     $product->setDescription('Awesome ' . $productName);
     if ($this->sharedStorage->has('channel')) {
         $channel = $this->sharedStorage->get('channel');
         $product->addChannel($channel);
     }
     $this->saveProduct($product);
 }
開發者ID:origammi,項目名稱:Sylius,代碼行數:15,代碼來源:ProductContext.php

示例4: storeHasAConfigurableProduct

 /**
  * @Given the store has a :productName configurable product
  */
 public function storeHasAConfigurableProduct($productName)
 {
     /** @var ProductInterface $product */
     $product = $this->productFactory->createNew();
     $product->setName($productName);
     $product->setCode($this->convertToCode($productName));
     $product->setDescription('Awesome ' . $productName);
     if ($this->sharedStorage->has('channel')) {
         $channel = $this->sharedStorage->get('channel');
         $product->addChannel($channel);
     }
     $this->saveProduct($product);
 }
開發者ID:TheMadeleine,項目名稱:Sylius,代碼行數:16,代碼來源:ProductContext.php

示例5: storeHasAConfigurableProduct

 /**
  * @Given the store has a :productName configurable product
  */
 public function storeHasAConfigurableProduct($productName)
 {
     /** @var ProductInterface $product */
     $product = $this->productFactory->createNew();
     $product->setName($productName);
     $product->setCode(StringInflector::nameToUppercaseCode($productName));
     $product->setSlug($this->slugGenerator->generate($productName));
     $product->setDescription('Awesome ' . $productName);
     if ($this->sharedStorage->has('channel')) {
         $channel = $this->sharedStorage->get('channel');
         $product->addChannel($channel);
     }
     $this->saveProduct($product);
 }
開發者ID:loic425,項目名稱:Sylius,代碼行數:17,代碼來源:ProductContext.php

示例6: createPaymentMethodFromNameAndCode

 /**
  * @param string $name
  * @param string $code
  * @param bool $addForCurrentChannel
  * @param string $description
  */
 private function createPaymentMethodFromNameAndCode($name, $code, $description = '', $addForCurrentChannel = true)
 {
     /** @var PaymentMethodInterface $paymentMethod */
     $paymentMethod = $this->paymentMethodFactory->createNew();
     $paymentMethod->setName(ucfirst($name));
     $paymentMethod->setCode($code);
     $paymentMethod->setGateway($this->paymentMethodNameToGatewayConverter->convert($name));
     $paymentMethod->setDescription($description);
     if ($addForCurrentChannel && $this->sharedStorage->has('channel')) {
         $channel = $this->sharedStorage->get('channel');
         $channel->addPaymentMethod($paymentMethod);
     }
     $this->sharedStorage->set('payment_method', $paymentMethod);
     $this->paymentMethodRepository->add($paymentMethod);
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:21,代碼來源:PaymentContext.php

示例7: createProduct

 /**
  * @param string $productName
  * @param int $price
  * @param string|null $date
  * @param ChannelInterface|null $channel
  *
  * @return ProductInterface
  */
 private function createProduct($productName, $price = 100, $date = null, ChannelInterface $channel = null)
 {
     /** @var ProductInterface $product */
     $product = $this->productFactory->createWithVariant();
     $product->setName($productName);
     $product->setCode(StringInflector::nameToUppercaseCode($productName));
     $product->setSlug($this->slugGenerator->generate($productName));
     $product->setCreatedAt(new \DateTime($date));
     /** @var ProductVariantInterface $productVariant */
     $productVariant = $this->defaultVariantResolver->getVariant($product);
     if (null === $channel && $this->sharedStorage->has('channel')) {
         $channel = $this->sharedStorage->get('channel');
     }
     if (null !== $channel) {
         $productVariant->addChannelPricing($this->createChannelPricingForChannel($price, $channel));
     }
     $productVariant->setCode($product->getCode());
     return $product;
 }
開發者ID:sylius,項目名稱:sylius,代碼行數:27,代碼來源:ProductContext.php


注:本文中的Sylius\Behat\Service\SharedStorageInterface::has方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。