当前位置: 首页>>代码示例>>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;未经允许,请勿转载。