当前位置: 首页>>代码示例>>PHP>>正文


PHP FactoryInterface::createNew方法代码示例

本文整理汇总了PHP中Sylius\Component\Resource\Factory\FactoryInterface::createNew方法的典型用法代码示例。如果您正苦于以下问题:PHP FactoryInterface::createNew方法的具体用法?PHP FactoryInterface::createNew怎么用?PHP FactoryInterface::createNew使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sylius\Component\Resource\Factory\FactoryInterface的用法示例。


在下文中一共展示了FactoryInterface::createNew方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createWithVariant

 /**
  * {@inheritdoc}
  */
 public function createWithVariant()
 {
     $variant = $this->variantFactory->createNew();
     $product = $this->factory->createNew();
     $product->addVariant($variant);
     return $product;
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:ProductFactory.php

示例2: createWithCustomer

 /**
  * {@inheritdoc}
  */
 public function createWithCustomer(CustomerInterface $customer)
 {
     /** @var  AddressInterface $address*/
     $address = $this->decoratedFactory->createNew();
     $address->setCustomer($customer);
     return $address;
 }
开发者ID:loic425,项目名称:Sylius,代码行数:10,代码来源:AddressFactory.php

示例3: createNew

 /**
  * {@inheritdoc}
  */
 public function createNew()
 {
     /** @var StaticContent $staticContent */
     $staticContent = $this->decoratedFactory->createNew();
     $staticContent->setParentDocument($this->documentManager->find(null, $this->staticContentParentPath));
     return $staticContent;
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:StaticContentFactory.php

示例4: generate

 /**
  * {@inheritdoc}
  */
 public function generate(VariableInterface $variable)
 {
     if (!$variable->hasOptions()) {
         throw new \InvalidArgumentException('Cannot generate variants for an object without options.');
     }
     $optionSet = array();
     $optionMap = array();
     foreach ($variable->getOptions() as $k => $option) {
         foreach ($option->getValues() as $value) {
             $optionSet[$k][] = $value->getId();
             $optionMap[$value->getId()] = $value;
         }
     }
     $permutations = $this->setBuilder->build($optionSet);
     foreach ($permutations as $permutation) {
         $variant = $this->variantFactory->createNew();
         $variant->setObject($variable);
         $variant->setDefaults($variable->getMasterVariant());
         if (is_array($permutation)) {
             foreach ($permutation as $id) {
                 $variant->addOption($optionMap[$id]);
             }
         } else {
             $variant->addOption($optionMap[$permutation]);
         }
         $variable->addVariant($variant);
         $this->process($variable, $variant);
     }
 }
开发者ID:aleherse,项目名称:Sylius,代码行数:32,代码来源:VariantGenerator.php

示例5: createNew

 /**
  * {@inheritdoc}
  */
 public function createNew()
 {
     /** @var Route $route */
     $route = $this->decoratedFactory->createNew();
     $route->setParentDocument($this->documentManager->find(null, $this->routeParentPath));
     return $route;
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:RouteFactory.php

示例6: load

 /**
  * {@inheritdoc}
  */
 public function load($schemaAlias, $namespace = null, $ignoreUnknown = true)
 {
     /** @var SchemaInterface $schema */
     $schema = $this->schemaRegistry->get($schemaAlias);
     /** @var SettingsResolverInterface $resolver */
     $resolver = $this->resolverRegistry->get($schemaAlias);
     // try to resolve settings for schema alias and namespace
     $settings = $resolver->resolve($schemaAlias, $namespace);
     if (!$settings) {
         $settings = $this->settingsFactory->createNew();
         $settings->setSchemaAlias($schemaAlias);
     }
     // We need to get a plain parameters array since we use the options resolver on it
     $parameters = $settings->getParameters();
     $settingsBuilder = new SettingsBuilder();
     $schema->buildSettings($settingsBuilder);
     // Remove unknown settings' parameters (e.g. From a previous version of the settings schema)
     if (true === $ignoreUnknown) {
         foreach ($parameters as $name => $value) {
             if (!$settingsBuilder->isDefined($name)) {
                 unset($parameters[$name]);
             }
         }
     }
     $parameters = $settingsBuilder->resolve($parameters);
     $settings->setParameters($parameters);
     return $settings;
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:31,代码来源:SettingsManager.php

示例7: createForPromotion

 /**
  * {@inheritdoc}
  */
 public function createForPromotion(PromotionInterface $promotion)
 {
     Assert::true($promotion->isCouponBased(), sprintf('Promotion with name %s is not coupon based.', $promotion->getName()));
     $coupon = $this->factory->createNew();
     $coupon->setPromotion($promotion);
     return $coupon;
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:CouponFactory.php

示例8: theStoreHasDisabledLocale

 /**
  * @Given the store has disabled locale :localeCode
  */
 public function theStoreHasDisabledLocale($localeCode)
 {
     $locale = $this->localeFactory->createNew();
     $locale->setCode($localeCode);
     $locale->disable();
     $this->saveLocale($locale);
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:10,代码来源:LocaleContext.php

示例9: createTaxon

 /**
  * @param string $name
  *
  * @return TaxonInterface
  */
 private function createTaxon($name)
 {
     $taxon = $this->taxonFactory->createNew();
     $taxon->setName($name);
     $taxon->setCode($this->getCodeFromName($name));
     return $taxon;
 }
开发者ID:Mozan,项目名称:Sylius,代码行数:12,代码来源:TaxonomyContext.php

示例10: createNew

 /**
  * {@inheritdoc}
  */
 public function createNew()
 {
     $taxon = $this->taxonFactory->createNew();
     $taxonomy = $this->translatableFactory->createNew();
     $taxonomy->setRoot($taxon);
     return $taxonomy;
 }
开发者ID:malukenho,项目名称:Sylius,代码行数:10,代码来源:TaxonomyFactory.php

示例11: create

 /**
  * {@inheritdoc}
  */
 public function create(array $options = [])
 {
     $options = $this->optionsResolver->resolve($options);
     /** @var PromotionInterface $promotion */
     $promotion = $this->promotionFactory->createNew();
     $promotion->setCode($options['code']);
     $promotion->setName($options['name']);
     $promotion->setDescription($options['description']);
     $promotion->setCouponBased($options['coupon_based']);
     $promotion->setUsageLimit($options['usage_limit']);
     $promotion->setExclusive($options['exclusive']);
     $promotion->setPriority($options['priority']);
     if (isset($options['starts_at'])) {
         $promotion->setStartsAt(new \DateTime($options['starts_at']));
     }
     if (isset($options['ends_at'])) {
         $promotion->setEndsAt(new \DateTime($options['ends_at']));
     }
     foreach ($options['channels'] as $channel) {
         $promotion->addChannel($channel);
     }
     foreach ($options['rules'] as $rule) {
         /** @var PromotionRuleInterface $promotionRule */
         $promotionRule = $this->promotionRuleExampleFactory->create($rule);
         $promotion->addRule($promotionRule);
     }
     foreach ($options['actions'] as $action) {
         /** @var PromotionActionInterface $promotionAction */
         $promotionAction = $this->promotionActionExampleFactory->create($action);
         $promotion->addAction($promotionAction);
     }
     return $promotion;
 }
开发者ID:NeverResponse,项目名称:Sylius,代码行数:36,代码来源:PromotionExampleFactory.php

示例12: createCountryNamed

 /**
  * @param string $name
  */
 private function createCountryNamed($name)
 {
     /** @var CountryInterface $country */
     $country = $this->countryFactory->createNew();
     $country->setCode($this->countryNameConverter->convertToCode($name));
     $this->countryRepository->add($country);
 }
开发者ID:Mozan,项目名称:Sylius,代码行数:10,代码来源:GeographicalContext.php

示例13: createCountryNamed

 /**
  * @param string $name
  */
 private function createCountryNamed($name)
 {
     /** @var CountryInterface $country */
     $country = $this->countryFactory->createNew();
     $country->setCode($this->getCountryCodeByEnglishCountryName($name));
     $this->countryRepository->add($country);
 }
开发者ID:stevedien,项目名称:Sylius,代码行数:10,代码来源:GeographicalContext.php

示例14: getItemFormView

 /**
  * @param array $options
  *
  * @return FormView
  */
 public function getItemFormView(array $options = array())
 {
     $cartItem = $this->cartItemFactory->createNew();
     $this->orderItemQuantityModifier->modify($cartItem, 1);
     $form = $this->formFactory->create('sylius_cart_item', $cartItem, $options);
     return $form->createView();
 }
开发者ID:benakacha,项目名称:Sylius,代码行数:12,代码来源:CartHelper.php

示例15: createCustomerGroup

 /**
  * @param string $name
  */
 private function createCustomerGroup($name)
 {
     /** @var CustomerGroupInterface $customerGroup */
     $customerGroup = $this->customerGroupFactory->createNew();
     $customerGroup->setName(ucfirst($name));
     $this->sharedStorage->set('customer_group', $customerGroup);
     $this->customerGroupRepository->add($customerGroup);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:11,代码来源:CustomerGroupContext.php


注:本文中的Sylius\Component\Resource\Factory\FactoryInterface::createNew方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。