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


PHP ProductValueInterface::isRemovable方法代码示例

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


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

示例1:

 function it_adds_multiple_product_values_children_in_the_same_group(ProductValueInterface $valueOne, AttributeInterface $attributeOne, ProductValueInterface $valueTwo, AttributeInterface $attributeTwo, AttributeGroup $group, FormView $valueFormView, $viewUpdaterRegistry)
 {
     $valueOne->getAttribute()->willReturn($attributeOne);
     $valueOne->isRemovable()->willReturn(true);
     $valueOne->getLocale()->willReturn(null);
     $valueOne->getEntity()->willReturn(null);
     $attributeOne->getGroup()->willReturn($group);
     $attributeOne->getId()->willReturn(42);
     $attributeOne->getCode()->willReturn('name');
     $attributeOne->getLabel()->willReturn('Name');
     $attributeOne->getSortOrder()->willReturn(10);
     $attributeOne->getAttributeType()->willReturn('pim_catalog_text');
     $attributeOne->isLocalizable()->willReturn(false);
     $attributeOne->isScopable()->willReturn(false);
     $valueTwo->getAttribute()->willReturn($attributeTwo);
     $valueTwo->isRemovable()->willReturn(true);
     $valueTwo->getLocale()->willReturn(null);
     $valueTwo->getEntity()->willReturn(null);
     $attributeTwo->getGroup()->willReturn($group);
     $attributeTwo->getId()->willReturn(47);
     $attributeTwo->getCode()->willReturn('description');
     $attributeTwo->getLabel()->willReturn('Description');
     $attributeTwo->getSortOrder()->willReturn(15);
     $attributeTwo->getAttributeType()->willReturn('pim_catalog_text');
     $attributeTwo->isLocalizable()->willReturn(false);
     $attributeTwo->isScopable()->willReturn(false);
     $group->getId()->willReturn(1);
     $group->getCode()->willReturn('general');
     $group->getLabel()->willReturn('General');
     $this->addChildren($valueOne, $valueFormView);
     $this->addChildren($valueTwo, $valueFormView);
     $viewUpdaterRegistry->getUpdaters()->willReturn([]);
     $resultView = [1 => ['label' => 'General', 'attributes' => ['name' => ['id' => 42, 'isRemovable' => true, 'code' => 'name', 'label' => 'Name', 'sortOrder' => 10, 'allowValueCreation' => false, 'locale' => null, 'value' => $valueFormView], 'description' => ['id' => 47, 'isRemovable' => true, 'code' => 'description', 'label' => 'Description', 'sortOrder' => 15, 'allowValueCreation' => false, 'locale' => null, 'value' => $valueFormView]]]];
     $this->getView()->shouldReturn($resultView);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:35,代码来源:ProductFormViewSpec.php

示例2: prepareAttributeView

 /**
  * Prepare attribute view
  *
  * @param AttributeInterface    $attribute
  * @param ProductValueInterface $value
  * @param FormView              $view
  *
  * @return array
  */
 protected function prepareAttributeView(AttributeInterface $attribute, ProductValueInterface $value, FormView $view)
 {
     $attributeView = ['id' => $attribute->getId(), 'isRemovable' => $value->isRemovable(), 'code' => $attribute->getCode(), 'label' => $attribute->getLabel(), 'sortOrder' => $attribute->getSortOrder(), 'allowValueCreation' => in_array($attribute->getAttributeType(), $this->choiceAttributeTypes), 'locale' => $value->getLocale()];
     if ($attribute->isScopable()) {
         $attributeView['values'] = array_merge($this->getAttributeValues($attribute, $value->getLocale()), [$value->getScope() => $view]);
         ksort($attributeView['values']);
     } else {
         $attributeView['value'] = $view;
     }
     $classes = $this->getAttributeClasses($attribute);
     if (!empty($classes)) {
         $attributeView['classes'] = $classes;
     }
     return $attributeView;
 }
开发者ID:qrz-io,项目名称:pim-community-dev,代码行数:24,代码来源:ProductFormView.php


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