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


PHP Model\ProductInterface類代碼示例

本文整理匯總了PHP中Sylius\Component\Core\Model\ProductInterface的典型用法代碼示例。如果您正苦於以下問題:PHP ProductInterface類的具體用法?PHP ProductInterface怎麽用?PHP ProductInterface使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1:

 function it_generates_correct_hierarchy_when_product_does_not_have_archetype(ProductInterface $product)
 {
     $product->getMetadataIdentifier()->shouldBeCalled()->willReturn('Product-42');
     $product->getMetadataClassIdentifier()->shouldBeCalled()->willReturn('Product');
     $product->getArchetype()->shouldBeCalled()->willReturn(null);
     $this->getHierarchyByMetadataSubject($product)->shouldReturn(['Product-42', 'Product', 'DefaultPage']);
 }
開發者ID:TeamNovatek,項目名稱:Sylius,代碼行數:7,代碼來源:ProductHierarchyProviderSpec.php

示例2: isThereProduct

 /**
  * {@inheritdoc}
  */
 public function isThereProduct(ProductInterface $product)
 {
     if (!($table = $this->getDocument()->find('css', 'table'))) {
         return false;
     }
     $row = $this->tableManipulator->getRowWithFields($table, ['id' => $product->getId()]);
     return null === $row;
 }
開發者ID:Mozan,項目名稱:Sylius,代碼行數:11,代碼來源:IndexPage.php

示例3:

 function it_is_restricted_if_zone_matcher_match_customers_shipping_address(ProductInterface $product, $customerContext, $zoneMatcher, CustomerInterface $customer, AddressInterface $address, ProductInterface $product, ZoneInterface $zone)
 {
     $customerContext->getCustomer()->shouldBeCalled()->willReturn($customer);
     $customer->getShippingAddress()->shouldBeCalled()->willReturn($address);
     $product->getRestrictedZone()->shouldBeCalled()->willReturn($zone);
     $zoneMatcher->matchAll($address)->shouldBeCalled()->willReturn(array($zone));
     $this->isRestricted($product)->shouldReturn(true);
 }
開發者ID:Strontium-90,項目名稱:Sylius,代碼行數:8,代碼來源:RestrictedZoneCheckerSpec.php

示例4:

 function it_recognizes_a_subject_as_not_eligible_if_a_product_taxon_is_not_matched(OrderInterface $subject, OrderItemInterface $item, ProductInterface $reflexBow, TaxonInterface $bows)
 {
     $configuration = ['taxons' => ['swords', 'axes']];
     $bows->getCode()->willReturn('bows');
     $reflexBow->getTaxons()->willReturn([$bows]);
     $item->getProduct()->willReturn($reflexBow);
     $subject->getItems()->willReturn([$item]);
     $this->isEligible($subject, $configuration)->shouldReturn(false);
 }
開發者ID:loic425,項目名稱:Sylius,代碼行數:9,代碼來源:TaxonRuleCheckerSpec.php

示例5: provideVariantsPrices

 /**
  * {@inheritdoc}
  */
 public function provideVariantsPrices(ProductInterface $product)
 {
     $variantsPrices = [];
     /** @var ProductVariantInterface $variant */
     foreach ($product->getVariants() as $variant) {
         $variantsPrices[] = $this->constructOptionsMap($variant);
     }
     return $variantsPrices;
 }
開發者ID:gabiudrescu,項目名稱:Sylius,代碼行數:12,代碼來源:ProductVariantsPricesProvider.php

示例6: hasProductValidTaxon

 /**
  * @param ProductInterface $product
  * @param array $taxons
  *
  * @return bool
  */
 private function hasProductValidTaxon(ProductInterface $product, array $taxons)
 {
     foreach ($product->getTaxons() as $taxon) {
         if (in_array($taxon->getCode(), $taxons)) {
             return true;
         }
     }
     return false;
 }
開發者ID:TheMadeleine,項目名稱:Sylius,代碼行數:15,代碼來源:TaxonFilter.php

示例7: iDeleteTheProduct

 /**
  * @When /^I delete the ("[^"]+" product)$/
  * @When /^I try to delete the ("([^"]+)" product)$/
  */
 public function iDeleteTheProduct(ProductInterface $product)
 {
     try {
         $this->sharedStorage->set('product_id', $product->getId());
         $this->productRepository->remove($product);
     } catch (DBALException $exception) {
         $this->sharedStorage->set('last_exception', $exception);
     }
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:13,代碼來源:ManagingProductsContext.php

示例8:

 function it_is_restricted_if_zone_matcher_match_users_shipping_address(ProductInterface $product, $securityContext, $zoneMatcher, TokenInterface $token, UserInterface $user, AddressInterface $address, ProductInterface $product, ZoneInterface $zone)
 {
     $securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED')->shouldBeCalled()->willReturn(true);
     $securityContext->getToken()->shouldBeCalled()->willReturn($token);
     $token->getUser()->shouldBeCalled()->willReturn($user);
     $user->getShippingAddress()->shouldBeCalled()->willReturn($address);
     $product->getRestrictedZone()->shouldBeCalled()->willReturn($zone);
     $zoneMatcher->matchAll($address)->shouldBeCalled()->willReturn(array($zone));
     $this->isRestricted($product)->shouldReturn(true);
 }
開發者ID:bcremer,項目名稱:Sylius,代碼行數:10,代碼來源:RestrictedZoneCheckerSpec.php

示例9:

 function it_adds_single_item_by_customer(FactoryInterface $orderItemFactory, OrderInterface $order, OrderItemInterface $item, OrderItemQuantityModifierInterface $itemQuantityModifier, ProductInterface $product, SharedStorageInterface $sharedStorage, ProductVariantInterface $variant, ObjectManager $objectManager)
 {
     $sharedStorage->get('order')->willReturn($order);
     $orderItemFactory->createNew()->willReturn($item);
     $product->getMasterVariant()->willReturn($variant);
     $product->getPrice()->willReturn(1234);
     $itemQuantityModifier->modify($item, 1)->shouldBeCalled();
     $item->setVariant($variant)->shouldBeCalled();
     $item->setUnitPrice(1234)->shouldBeCalled();
     $order->addItem($item)->shouldBeCalled();
     $objectManager->flush()->shouldBeCalled();
     $this->theCustomerBoughtSingle($product);
 }
開發者ID:starspire,項目名稱:eventmanager,代碼行數:13,代碼來源:OrderContextSpec.php

示例10:

 function it_provides_array_containing_product_variant_options_map_with_corresponding_price(ProductInterface $tShirt, ProductOptionValueInterface $black, ProductOptionValueInterface $large, ProductOptionValueInterface $small, ProductOptionValueInterface $white, ProductVariantInterface $blackLargeTShirt, ProductVariantInterface $blackSmallTShirt, ProductVariantInterface $whiteLargeTShirt, ProductVariantInterface $whiteSmallTShirt)
 {
     $tShirt->getVariants()->willReturn([$blackSmallTShirt, $whiteSmallTShirt, $blackLargeTShirt, $whiteLargeTShirt]);
     $blackSmallTShirt->getOptionValues()->willReturn([$black, $small]);
     $whiteSmallTShirt->getOptionValues()->willReturn([$white, $small]);
     $blackLargeTShirt->getOptionValues()->willReturn([$black, $large]);
     $whiteLargeTShirt->getOptionValues()->willReturn([$white, $large]);
     $blackSmallTShirt->getPrice()->willReturn(1000);
     $whiteSmallTShirt->getPrice()->willReturn(1500);
     $blackLargeTShirt->getPrice()->willReturn(2000);
     $whiteLargeTShirt->getPrice()->willReturn(2500);
     $black->getOptionCode()->willReturn('t_shirt_color');
     $white->getOptionCode()->willReturn('t_shirt_color');
     $small->getOptionCode()->willReturn('t_shirt_size');
     $large->getOptionCode()->willReturn('t_shirt_size');
     $black->getValue()->willReturn('Black');
     $white->getValue()->willReturn('White');
     $small->getValue()->willReturn('Small');
     $large->getValue()->willReturn('Large');
     $this->provideVariantsPrices($tShirt)->shouldReturn([['t_shirt_color' => 'Black', 't_shirt_size' => 'Small', 'value' => 1000], ['t_shirt_color' => 'White', 't_shirt_size' => 'Small', 'value' => 1500], ['t_shirt_color' => 'Black', 't_shirt_size' => 'Large', 'value' => 2000], ['t_shirt_color' => 'White', 't_shirt_size' => 'Large', 'value' => 2500]]);
 }
開發者ID:TheMadeleine,項目名稱:Sylius,代碼行數:21,代碼來源:ProductVariantsPricesProviderSpec.php

示例11: configureProductPricingCalculator

 /**
  * @param ProductInterface $product
  * @param array            $data
  */
 private function configureProductPricingCalculator(ProductInterface $product, array $data)
 {
     $product->getMasterVariant()->setPricingCalculator($data['pricing calculator']);
     if (!isset($data['calculator configuration']) || '' === $data['calculator configuration']) {
         throw new \InvalidArgumentException('You must set chosen calculator configuration');
     }
     $product->getMasterVariant()->setPricingConfiguration($this->getPricingCalculatorConfiguration($data));
 }
開發者ID:dominikjaglo,項目名稱:Sylius,代碼行數:12,代碼來源:ProductContext.php

示例12: thisProductAverageRatingShouldBe

 /**
  * @Then /^average rating of (product "[^"]+") should be (\d+)$/
  */
 public function thisProductAverageRatingShouldBe(ProductInterface $product, $averageRating)
 {
     $this->showPage->tryToOpen(['slug' => $product->getSlug()]);
     $this->iShouldSeeAsItsAverageRating($averageRating);
 }
開發者ID:sylius,項目名稱:sylius,代碼行數:8,代碼來源:ProductContext.php

示例13: setProductsQuantity

 /**
  * @param ProductInterface $product
  * @param int $quantity
  */
 private function setProductsQuantity(ProductInterface $product, $quantity)
 {
     $product->getFirstVariant()->setOnHand($quantity);
     $this->saveProduct($product);
 }
開發者ID:origammi,項目名稱:Sylius,代碼行數:9,代碼來源:ProductContext.php

示例14:

 function it_adds_taxon_to_product(ProductInterface $product, TaxonInterface $taxon)
 {
     $product->addTaxon($taxon)->shouldBeCalled();
     $this->itBelongsTo($product, $taxon);
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:5,代碼來源:TaxonomyContextSpec.php

示例15: addTranslatedFields

 protected function addTranslatedFields(ProductInterface $product, $translatedNames)
 {
     foreach ($translatedNames as $locale => $name) {
         $product->setCurrentLocale($locale);
         $product->setFallbackLocale($locale);
         $product->setName($name);
         $product->setDescription($this->fakers[$locale]->paragraph);
         $product->setShortDescription($this->fakers[$locale]->sentence);
         $product->setMetaKeywords(str_replace(' ', ', ', $this->fakers[$locale]->sentence));
         $product->setMetaDescription($this->fakers[$locale]->sentence);
     }
     $product->setCurrentLocale($this->defaultLocale);
 }
開發者ID:vikey89,項目名稱:Sylius,代碼行數:13,代碼來源:LoadProductsData.php


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