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


PHP ProductInterface::removeValue方法代码示例

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


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

示例1: removeAttributeFromProduct

 /**
  * {@inheritdoc}
  */
 public function removeAttributeFromProduct(ProductInterface $product, AttributeInterface $attribute)
 {
     foreach ($product->getValues() as $value) {
         if ($attribute === $value->getAttribute()) {
             $product->removeValue($value);
         }
     }
     $this->objectManager->flush($product);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:12,代码来源:ProductBuilder.php

示例2: denormalizeValues

 /**
  * Denormalize product values
  *
  * @param string           $data
  * @param string           $format
  * @param array            $context
  * @param ProductInterface $product
  */
 protected function denormalizeValues($data, $format, array $context, ProductInterface $product)
 {
     foreach ($product->getValues() as $value) {
         $product->removeValue($value);
     }
     foreach ($data as $attFieldName => $dataValue) {
         $attributeInfos = $this->fieldNameBuilder->extractAttributeFieldNameInfos($attFieldName);
         $attribute = $attributeInfos['attribute'];
         unset($attributeInfos['attribute']);
         if (!$product->hasAttribute($attribute)) {
             $this->productBuilder->addAttributeToProduct($product, $attribute);
         }
         // Denormalize data value.
         // The value is already added to the product so automatically updated
         $productValue = $product->getValue($attribute->getCode(), $attributeInfos['locale_code'], $attributeInfos['scope_code']);
         $this->serializer->denormalize($dataValue, $this->productValueClass, $format, ['product' => $product, 'entity' => $productValue] + $attributeInfos + $context);
     }
 }
开发者ID:vpetrovych,项目名称:pim-community-dev,代码行数:26,代码来源:ProductDenormalizer.php

示例3: removeAttributeFromProduct

 /**
  * Deletes values that link an attribute to a product
  *
  * @param ProductInterface   $product
  * @param AttributeInterface $attribute
  * @param array              $savingOptions
  *
  * @deprecated Will be removed in 1.5, please use ProductBuilderInterface::removeAttributeFromProduct() and
  *             ProductSaver::save() instead.
  */
 public function removeAttributeFromProduct(ProductInterface $product, AttributeInterface $attribute, array $savingOptions = [])
 {
     foreach ($product->getValues() as $value) {
         if ($attribute === $value->getAttribute()) {
             $product->removeValue($value);
         }
     }
     $options = array_merge(['recalculate' => false, 'schedule' => false], $savingOptions);
     $this->productSaver->save($product, $options);
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:20,代码来源:ProductManager.php


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