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


PHP Model\GroupInterface类代码示例

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


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

示例1:

 function it_provides_formatted_batch_config_for_the_job(GroupInterface $oroTshirt)
 {
     $oroTshirt->getCode()->willReturn('oro_tshirt');
     $this->setGroup($oroTshirt);
     $this->setFilters([['id', 'IN', ['22', '7']]]);
     $this->getBatchConfig()->shouldReturn('{\\"filters\\":[[\\"id\\",\\"IN\\",[\\"22\\",\\"7\\"]]],\\"actions\\":{\\"field\\":\\"variant_group\\",\\"value\\":\\"oro_tshirt\\"}}');
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:7,代码来源:AddToVariantGroupSpec.php

示例2:

 function it_fails_if_the_group_code_is_not_found($groupRepository, ProductInterface $product, GroupInterface $pack, GroupTypeInterface $nonVariantType)
 {
     $groupRepository->findOneByIdentifier('not valid code')->willReturn(null);
     $pack->getType()->willReturn($nonVariantType);
     $nonVariantType->isVariant()->willReturn(false);
     $this->shouldThrow(InvalidArgumentException::expected('variant_group', 'existing variant group code', 'setter', 'variant_group', 'not valid code'))->during('setFieldData', [$product, 'variant_group', 'not valid code']);
 }
开发者ID:vpetrovych,项目名称:pim-community-dev,代码行数:7,代码来源:VariantGroupFieldSetterSpec.php

示例3:

 function it_normalizes_an_existing_product_into_mongodb_document($mongoFactory, $serializer, ProductInterface $product, \MongoId $mongoId, \MongoDate $mongoDate, Association $assoc1, Association $assoc2, CategoryInterface $category1, CategoryInterface $category2, GroupInterface $group1, GroupInterface $group2, ProductValueInterface $value1, ProductValueInterface $value2, FamilyInterface $family)
 {
     $mongoFactory->createMongoId('product1')->willReturn($mongoId);
     $mongoFactory->createMongoDate()->willReturn($mongoDate);
     $family->getId()->willReturn(36);
     $category1->getId()->willReturn(12);
     $category2->getId()->willReturn(34);
     $group1->getId()->willReturn(56);
     $group2->getId()->willReturn(78);
     $product->getId()->willReturn('product1');
     $product->getCreated()->willReturn(null);
     $product->getFamily()->willReturn($family);
     $product->isEnabled()->willReturn(true);
     $product->getGroups()->willReturn([$group1, $group2]);
     $product->getCategories()->willReturn([$category1, $category2]);
     $product->getAssociations()->willReturn([$assoc1, $assoc2]);
     $product->getValues()->willReturn([$value1, $value2]);
     $context = ['_id' => $mongoId];
     $serializer->normalize($product, 'mongodb_json')->willReturn(['data' => 'data', 'completenesses' => 'completenesses']);
     $serializer->normalize($value1, 'mongodb_document', $context)->willReturn('my_value_1');
     $serializer->normalize($value2, 'mongodb_document', $context)->willReturn('my_value_2');
     $serializer->normalize($assoc1, 'mongodb_document', $context)->willReturn('my_assoc_1');
     $serializer->normalize($assoc2, 'mongodb_document', $context)->willReturn('my_assoc_2');
     $this->normalize($product, 'mongodb_document')->shouldReturn(['_id' => $mongoId, 'created' => $mongoDate, 'updated' => $mongoDate, 'family' => 36, 'enabled' => true, 'groupIds' => [56, 78], 'categoryIds' => [12, 34], 'associations' => ['my_assoc_1', 'my_assoc_2'], 'values' => ['my_value_1', 'my_value_2'], 'normalizedData' => ['data' => 'data'], 'completenesses' => []]);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:25,代码来源:ProductNormalizerSpec.php

示例4:

 function it_throws_an_error_if_type_is_unknown(GroupInterface $group)
 {
     $group->setCode('mycode')->shouldBeCalled();
     $group->getId()->willReturn(null);
     $values = ['code' => 'mycode', 'type' => 'UNKNOWN'];
     $this->shouldThrow(new \InvalidArgumentException('Type "UNKNOWN" does not exist'))->during('update', [$group, $values, []]);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:7,代码来源:GroupUpdaterSpec.php

示例5: bindProducts

 /**
  * Bind products
  *
  * @param GroupInterface $group
  * @param array          $appendProducts
  * @param array          $removeProducts
  */
 protected function bindProducts(GroupInterface $group, array $appendProducts, array $removeProducts)
 {
     foreach ($appendProducts as $product) {
         $group->addProduct($product);
     }
     foreach ($removeProducts as $product) {
         $group->removeProduct($product);
     }
 }
开发者ID:qrz-io,项目名称:pim-community-dev,代码行数:16,代码来源:BindGroupProductsSubscriber.php

示例6: normalizeVariantGroupValues

 /**
  * Normalize the variant group values
  *
  * @param GroupInterface $group
  * @param string         $format
  * @param array          $context
  *
  * @return array
  */
 protected function normalizeVariantGroupValues(GroupInterface $group, $format, array $context)
 {
     $valuesData = [];
     if ($group->getType()->isVariant() && null !== $group->getProductTemplate()) {
         $template = $group->getProductTemplate();
         $valuesData = $template->getValuesData();
     }
     return $valuesData;
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:18,代码来源:GroupNormalizer.php

示例7: validateAttributeAxis

 /**
  * @param VariantGroupAxis $constraint
  * @param GroupInterface   $variantGroup
  */
 protected function validateAttributeAxis(VariantGroupAxis $constraint, GroupInterface $variantGroup)
 {
     $allowedTypes = [AttributeTypes::OPTION_SIMPLE_SELECT, AttributeTypes::REFERENCE_DATA_SIMPLE_SELECT];
     foreach ($variantGroup->getAxisAttributes() as $attribute) {
         if (!in_array($attribute->getAttributeType(), $allowedTypes)) {
             $this->addInvalidAxisViolation($constraint, $variantGroup->getCode(), $attribute->getCode());
         }
     }
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:13,代码来源:VariantGroupAxisValidator.php

示例8:

 function it_validates_products_with_one_variant_group($context, $onlyOneVariantGroup, ProductInterface $mug, GroupInterface $mugVariantGroup, GroupInterface $otherGroup, GroupTypeInterface $variantType, GroupTypeInterface $groupType)
 {
     $mug->getGroups()->willReturn([$mugVariantGroup, $otherGroup]);
     $mugVariantGroup->getType()->willReturn($variantType);
     $otherGroup->getType()->willReturn($groupType);
     $variantType->isVariant()->willReturn(true);
     $groupType->isVariant()->willReturn(false);
     $context->addViolation(Argument::any())->shouldNotBeCalled();
     $this->validate($mug, $onlyOneVariantGroup);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:10,代码来源:UniqueVariantGroupValidatorSpec.php

示例9: onSuccess

 /**
  * Call when form is valid
  *
  * @param GroupInterface $group
  */
 protected function onSuccess(GroupInterface $group)
 {
     $appendProducts = $this->form->get('appendProducts')->getData();
     $removeProducts = $this->form->get('removeProducts')->getData();
     $options = ['add_products' => $appendProducts, 'remove_products' => $removeProducts];
     if ($group->getType()->isVariant()) {
         $options['copy_values_to_products'] = true;
     }
     $this->groupSaver->save($group, $options);
 }
开发者ID:vpetrovych,项目名称:pim-community-dev,代码行数:15,代码来源:GroupHandler.php

示例10: Attribute

 function it_throws_an_error_if_axis_is_updated(GroupInterface $variantGroup)
 {
     $variantGroup->setCode('mycode')->shouldBeCalled();
     $variantGroup->getId()->willReturn(42);
     $attribute = new Attribute();
     $attribute->setCode('other');
     $variantGroup->getAxisAttributes()->willReturn(new ArrayCollection([$attribute]));
     $values = ['code' => 'mycode', 'axis' => ['main_color']];
     $this->shouldThrow(new \InvalidArgumentException('Attributes: This property cannot be changed.'))->during('update', [$variantGroup, $values, []]);
 }
开发者ID:CopeX,项目名称:pim-community-dev,代码行数:10,代码来源:VariantGroupUpdaterSpec.php

示例11: getMissingAxisCodes

 /**
  * Get missing axis codes of a product given a variant group
  *
  * @param ProductInterface $product
  * @param GroupInterface   $variantGroup
  *
  * @return array
  */
 protected function getMissingAxisCodes(ProductInterface $product, GroupInterface $variantGroup)
 {
     $missingAxisCodes = [];
     foreach ($variantGroup->getAxisAttributes() as $attribute) {
         $value = $product->getValue($attribute->getCode());
         if (null === $value || null === $value->getData()) {
             $missingAxisCodes[] = $attribute->getCode();
         }
     }
     return $missingAxisCodes;
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:19,代码来源:HasVariantAxesValidator.php

示例12: FileNotFoundException

 function it_throws_an_exception_if_media_of_variant_group_is_not_found($normalizer, $denormalizer, ArrayCollection $productValuesCollection, ArrayCollection $mediaCollection, ProductMediaInterface $media, GroupInterface $variantGroup, ProductTemplateInterface $productTemplate, ProductValueInterface $productValue)
 {
     $variantGroup->getProductTemplate()->willReturn($productTemplate);
     $variantGroup->getCode()->willReturn('my_variant_group');
     $productTemplate->getValuesData()->willReturn([$productValue]);
     $denormalizer->denormalize([$productValue], 'ProductValue[]', 'json')->willReturn($productValuesCollection);
     $productValuesCollection->filter(Argument::cetera())->willReturn($mediaCollection);
     $mediaCollection->toArray()->willReturn([$media]);
     $normalizer->normalize([$media], 'csv', ['field_name' => 'media', 'prepare_copy' => true, 'identifier' => 'my_variant_group'])->willThrow(new FileNotFoundException('upload/path/img.jpg'));
     $this->shouldThrow(new InvalidItemException('The file "upload/path/img.jpg" does not exist', ['item' => 'my_variant_group', 'uploadDirectory' => 'upload/path/']))->duringProcess($variantGroup);
 }
开发者ID:paulclarkin,项目名称:pim-community-dev,代码行数:11,代码来源:VariantGroupProcessorSpec.php

示例13:

 function it_returns_non_eligible_attributes($attributeRepository, GroupInterface $group, ProductTemplateInterface $template, AttributeInterface $length, AttributeInterface $name, AttributeInterface $color, AttributeInterface $identifier, Collection $collection)
 {
     $group->getProductTemplate()->willReturn($template);
     $group->getAxisAttributes()->willReturn($collection);
     $collection->toArray()->willReturn([$length]);
     $template->getValuesData()->willReturn(['name' => 'foo', 'color' => 'bar']);
     $attributeRepository->findOneByIdentifier('name')->willReturn($name);
     $attributeRepository->findOneByIdentifier('color')->willReturn($color);
     $attributeRepository->findBy(['unique' => true])->willReturn([$name, $identifier]);
     $attributes = [$length, $name, $color, $identifier];
     $this->getNonEligibleAttributes($group)->shouldReturn($attributes);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:12,代码来源:VariantGroupAttributesResolverSpec.php

示例14: prepareVariantGroupMedia

 /**
  * Prepares media files present in the product template of the variant group for export.
  * Returns an array of files to be copied from 'filePath' to 'exportPath'.
  *
  * @param GroupInterface $group
  *
  * @throws InvalidItemException If a media file is not found
  *
  * @return array
  */
 protected function prepareVariantGroupMedia(GroupInterface $group)
 {
     $mediaValues = $this->getProductTemplateMediaValues($group->getProductTemplate());
     if (count($mediaValues) < 1) {
         return [];
     }
     try {
         return $this->normalizer->normalize($mediaValues, $this->format, ['field_name' => 'media', 'prepare_copy' => true, 'identifier' => $group->getCode()]);
     } catch (FileNotFoundException $e) {
         throw new InvalidItemException($e->getMessage(), ['item' => $group->getCode(), 'uploadDirectory' => $this->uploadDirectory]);
     }
 }
开发者ID:umpirsky,项目名称:pim-community-dev,代码行数:22,代码来源:VariantGroupProcessor.php

示例15:

 function it_provides_formatted_batch_config_for_the_job(GroupInterface $officeGroup, GroupInterface $bedroomGroup, ArrayCollection $groupCollection)
 {
     $officeGroup->getCode()->willReturn('office_room');
     $bedroomGroup->getCode()->willReturn('bedroom');
     $groupCollection->add($officeGroup);
     $groupCollection->add($bedroomGroup);
     $this->setGroups($groupCollection);
     $groupCollection->map(Argument::type('closure'))->willReturn($groupCollection);
     $groupCollection->toArray()->willReturn(['office_room', 'bedroom']);
     $this->setFilters([['id', 'IN', ['22', '7']]]);
     $this->getBatchConfig()->shouldReturn('{\\"filters\\":[[\\"id\\",\\"IN\\",[\\"22\\",\\"7\\"]]],\\"actions\\":[{\\"field\\":\\"groups\\",\\"value\\":[\\"office_room\\",\\"bedroom\\"]}]}');
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:12,代码来源:AddToGroupsSpec.php


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