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


PHP AttributeInterface::isBackendTypeReferenceData方法代码示例

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


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

示例1: addData

 /**
  * {@inheritdoc}
  */
 public function addData($data)
 {
     $backendType = $this->attribute->getBackendType();
     if ($this->attribute->isBackendTypeReferenceData()) {
         $backendType = $this->attribute->getReferenceDataName();
     }
     if (substr($backendType, -1, 1) === 's') {
         $backendType = substr($backendType, 0, strlen($backendType) - 1);
     }
     $name = 'add' . ucfirst($backendType);
     return $this->{$name}($data);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:15,代码来源:AbstractProductValue.php

示例2:

 function it_sets_the_locale_and_scope_when_denormalizing_values($serializer, AttributeInterface $attribute)
 {
     $attribute->getAttributeType()->willReturn('pim_catalog_number');
     $attribute->getBackendType()->willReturn('decimal');
     $attribute->isBackendTypeReferenceData()->willReturn(false);
     $attribute->isLocalizable()->willReturn(true);
     $attribute->isScopable()->willReturn(true);
     $serializer->denormalize(1, 'pim_catalog_number', 'json', Argument::type('array'))->shouldBeCalled()->willReturn(1);
     $value = $this->denormalize(['data' => 1, 'locale' => 'en_US', 'scope' => 'ecommerce'], 'Pim\\Component\\Catalog\\Model\\ProductValue', 'json', ['attribute' => $attribute]);
     $value->shouldBeAnInstanceOf('Pim\\Component\\Catalog\\Model\\ProductValue');
     $value->getData()->shouldReturn(1);
     $value->getLocale()->shouldReturn('en_US');
     $value->getScope()->shouldReturn('ecommerce');
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:14,代码来源:ProductValueDenormalizerSpec.php

示例3:

 function it_adds_a_violation_when_validating_product_in_groups_with_non_unique_combination_of_axis_attributes($context, $productRepository, GroupInterface $tShirtVariantGroup, ProductInterface $redTShirtProduct, AttributeInterface $sizeAttribute, AttributeInterface $colorAttribute, ProductValueInterface $sizeProductValue, ProductValueInterface $colorProductValue, ProductInterface $redTShirtProduct2, UniqueVariantAxis $uniqueVariantAxisConstraint, ConstraintViolationBuilderInterface $violation)
 {
     $redTShirtProduct->getVariantGroup()->willReturn($tShirtVariantGroup);
     $tShirtVariantGroup->getId()->willReturn(1);
     $tShirtVariantGroup->getLabel()->willReturn('TShirts');
     $tShirtVariantGroup->getAxisAttributes()->willReturn([$sizeAttribute, $colorAttribute]);
     $sizeAttribute->getCode()->willReturn('size');
     $sizeAttribute->isBackendTypeReferenceData()->willReturn(true);
     $sizeAttribute->getReferenceDataName()->willReturn('ref_size');
     $colorAttribute->getCode()->willReturn('color');
     $colorAttribute->isBackendTypeReferenceData()->willReturn(true);
     $colorAttribute->getReferenceDataName()->willReturn('ref_color');
     $redTShirtProduct->getValue('size')->willReturn($sizeProductValue);
     $redTShirtProduct->getValue('color')->willReturn($colorProductValue);
     $redTShirtProduct->getId()->willReturn(1);
     $sizeProductValue->getData()->willReturn('XL');
     $sizeProductValue->getOption()->willReturn(null);
     $colorProductValue->getData()->willReturn('Red');
     $colorProductValue->getOption()->willReturn(null);
     $criteria = [['attribute' => $sizeAttribute, 'referenceData' => ['name' => 'ref_size', 'data' => 'XL']], ['attribute' => $colorAttribute, 'referenceData' => ['name' => 'ref_color', 'data' => 'Red']]];
     $productRepository->findAllForVariantGroup($tShirtVariantGroup, $criteria)->shouldBeCalled()->willReturn([$redTShirtProduct2]);
     $context->buildViolation('Group "%variant group%" already contains another product with values "%values%"', ['%variant group%' => 'TShirts', '%values%' => 'size: XL, color: Red'])->shouldBeCalled()->willReturn($violation);
     $this->validate($redTShirtProduct, $uniqueVariantAxisConstraint);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:24,代码来源:UniqueVariantAxisValidatorSpec.php

示例4: getFilterInformationForAttribute

 /**
  * Returns available information for the attribute and filters which supports it
  *
  * @param AttributeInterface $attribute
  * @param array              $attributeFilters
  *
  * @return array
  */
 protected function getFilterInformationForAttribute(AttributeInterface $attribute, array $attributeFilters)
 {
     $field = $attribute->getCode();
     $attributeType = $attribute->getAttributeType();
     $isLocalizable = $attribute->isLocalizable() ? 'yes' : 'no';
     $isScopable = $attribute->isScopable() ? 'yes' : 'no';
     $newEntries = [];
     if (array_key_exists($attributeType, $attributeFilters)) {
         foreach ($attributeFilters[$attributeType] as $filter) {
             $class = get_class($filter);
             $operators = implode(', ', $filter->getOperators());
             $newEntries[] = [$field, $isLocalizable, $isScopable, $attributeType, $operators, $class];
         }
         return $newEntries;
     }
     if ($attribute->isBackendTypeReferenceData()) {
         foreach ($this->registry->getAttributeFilters() as $filter) {
             if ($filter->supportsAttribute($attribute)) {
                 $class = get_class($filter);
                 $operators = implode(', ', $filter->getOperators());
                 $newEntries[] = [$field, $isLocalizable, $isScopable, $attributeType, $operators, $class];
             }
         }
         return $newEntries;
     }
     return [[$field, $isLocalizable, $isScopable, $attributeType, '', 'Not supported']];
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:35,代码来源:AttributeFilterDumper.php


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