本文整理汇总了PHP中Pim\Bundle\CatalogBundle\Model\AttributeInterface::getGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP AttributeInterface::getGroup方法的具体用法?PHP AttributeInterface::getGroup怎么用?PHP AttributeInterface::getGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pim\Bundle\CatalogBundle\Model\AttributeInterface
的用法示例。
在下文中一共展示了AttributeInterface::getGroup方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: realpath
function it_renders_a_product_with_an_image($templating, ProductInterface $blender, AttributeGroupInterface $media, AttributeInterface $mainImage)
{
$path = realpath(__DIR__ . '/../../../../../features/Context/fixtures/');
$blender->getAttributes()->willReturn([$mainImage]);
$mainImage->getGroup()->willReturn($media);
$media->getLabel()->willReturn('Media');
$mainImage->getCode()->willReturn('main_image');
$mainImage->getAttributeType()->willReturn('pim_catalog_image');
$templating->render(self::TEMPLATE_NAME, ['product' => $blender, 'locale' => 'en_US', 'scope' => 'ecommerce', 'groupedAttributes' => ['Media' => ['main_image' => $mainImage]], 'imageAttributes' => ['main_image' => $mainImage], 'uploadDir' => $path . DIRECTORY_SEPARATOR, 'customFont' => null])->shouldBeCalled();
$this->render($blender, 'pdf', ['locale' => 'en_US', 'scope' => 'ecommerce']);
}
示例2: realpath
function it_renders_a_product_with_an_image($templating, ProductInterface $blender, AttributeGroupInterface $media, AttributeInterface $mainImage, ProductValueInterface $productValue, FileInfoInterface $fileInfo, CacheManager $cacheManager)
{
$path = realpath(__DIR__ . '/../../../../../features/Context/fixtures/');
$blender->getAttributes()->willReturn([$mainImage]);
$blender->getValue("main_image", "en_US", "ecommerce")->willReturn($productValue);
$productValue->getMedia()->willReturn($fileInfo);
$fileInfo->getKey()->willReturn('fookey');
$cacheManager->isStored('fookey', 'thumbnail')->willReturn(true);
$mainImage->getGroup()->willReturn($media);
$media->getLabel()->willReturn('Media');
$mainImage->getCode()->willReturn('main_image');
$mainImage->getAttributeType()->willReturn('pim_catalog_image');
$templating->render(self::TEMPLATE_NAME, ['product' => $blender, 'locale' => 'en_US', 'scope' => 'ecommerce', 'groupedAttributes' => ['Media' => ['main_image' => $mainImage]], 'imageAttributes' => ['main_image' => $mainImage], 'uploadDir' => $path . DIRECTORY_SEPARATOR, 'customFont' => null])->shouldBeCalled();
$this->render($blender, 'pdf', ['locale' => 'en_US', 'scope' => 'ecommerce']);
}
示例3: let
function let(TranslationNormalizer $transnormalizer, AttributeInterface $attribute, AttributeGroupInterface $attributeGroup)
{
$this->beConstructedWith($transnormalizer);
$transnormalizer->normalize(Argument::cetera())->willReturn([]);
$attribute->getAttributeType()->willReturn('Yes/No');
$attribute->getCode()->willReturn('attribute_size');
$attribute->getGroup()->willReturn($attributeGroup);
$attributeGroup->getCode()->willReturn('size');
$attribute->isUnique()->willReturn(true);
$attribute->isUseableAsGridFilter()->willReturn(false);
$attribute->getAllowedExtensions()->willReturn(['csv', 'xml', 'json']);
$attribute->getMetricFamily()->willReturn('Length');
$attribute->getDefaultMetricUnit()->willReturn('Centimenter');
$attribute->getReferenceDataName()->willReturn('color');
$attribute->isLocalizable()->willReturn(true);
$attribute->isScopable()->willReturn(false);
}
示例4: getAttributeValues
/**
* @param AttributeInterface $attribute
* @param string $locale
*
* @return ArrayCollection
*/
protected function getAttributeValues(AttributeInterface $attribute, $locale)
{
$group = $attribute->getGroup();
$key = $attribute->getCode();
if ($locale) {
$key .= '_' . $locale;
}
if (!isset($this->view[$group->getId()]['attributes'][$key]['values'])) {
return [];
}
return $this->view[$group->getId()]['attributes'][$key]['values'];
}
示例5:
function it_gets_all_product_attributes_and_sets_correct_locale($attributeRepository, $massActionManager, AttributeInterface $attr1, AttributeInterface $attr2, AttributeGroupInterface $attrGroup, LocaleInterface $enLocale)
{
$enLocale->getCode()->willReturn('en_US');
$this->setLocale($enLocale);
$attributeRepository->findWithGroups([], ['conditions' => ['unique' => 0]])->shouldBeCalled()->willReturn([$attr1, $attr2]);
$attr1->setLocale('en_US')->shouldBeCalled();
$attr2->setLocale('en_US')->shouldBeCalled();
$attr1->getGroup()->willReturn($attrGroup);
$attr2->getGroup()->willReturn($attrGroup);
$massActionManager->filterLocaleSpecificAttributes([$attr1, $attr2], 'en_US')->willReturn([$attr1, $attr2]);
$attrGroup->setLocale('en_US')->shouldBeCalledTimes(2);
$this->getAllAttributes()->shouldReturn([$attr1, $attr2]);
}
示例6: hideGroupElement
/**
* Hide the group field with a default value = "Other"
*
* @param FormInterface $form Form
* @param AttributeInterface $data
*/
protected function hideGroupElement(FormInterface $form, AttributeInterface $data)
{
if (null !== $data->getId()) {
$group = $data->getGroup();
} else {
$group = $this->groupRepository->findDefaultAttributeGroup();
}
$formField = $form->get('group');
$options = $formField->getConfig()->getOptions();
$newOptions = ['data' => $group, 'class' => $options['class'], 'choices' => [$group], 'required' => true, 'multiple' => false, 'read_only' => true, 'attr' => ['class' => 'hide']];
$form->add('group', 'entity', $newOptions);
}
示例7:
function it_filters_attributes_coming_from_variant_group($massActionManager, $productBuilder, ProductInterface $product1, ProductInterface $product2, AttributeInterface $name, AttributeInterface $name, AttributeInterface $description, AttributeInterface $price, AttributeGroup $otherGroup, ProductValueInterface $nameProductValue, ProductValueInterface $descriptionProductValue, ProductValueInterface $priceProductValue)
{
$this->setObjectsToMassEdit([$product1, $product2]);
$name->getGroup()->willReturn($otherGroup);
$name->setLocale('en_US')->shouldBeCalled();
$otherGroup->setLocale('en_US')->shouldBeCalled();
$description->getGroup()->willReturn($otherGroup);
$description->setLocale('en_US')->shouldBeCalled();
$price->getGroup()->willReturn($otherGroup);
$price->setLocale('en_US')->shouldBeCalled();
$product1->getId()->willReturn(1);
$product2->getId()->willReturn(2);
$name->setLocale(Argument::any())->willReturn($name);
$name->isScopable()->willReturn(false);
$name->getCode()->willReturn('name');
$description->setLocale(Argument::any())->willReturn($description);
$description->isScopable()->willReturn(false);
$description->getCode()->willReturn('description');
$price->setLocale(Argument::any())->willReturn($price);
$price->isScopable()->willReturn(false);
$price->getCode()->willReturn('price');
$this->setObjectsToMassEdit([$product1, $product2]);
$massActionManager->findCommonAttributes([$product1, $product2])->willReturn([$name, $description, $price]);
$massActionManager->filterLocaleSpecificAttributes([$name, $description, $price], 'en_US')->willReturn([$name, $description, $price]);
$massActionManager->filterAttributesComingFromVariant([$name, $description, $price], [$product1, $product2])->willReturn([$name, $price]);
$productBuilder->createProductValue($name, 'en_US')->willReturn($nameProductValue);
$productBuilder->addMissingPrices($nameProductValue)->shouldBeCalled();
$productBuilder->createProductValue($price, 'en_US')->willReturn($priceProductValue);
$productBuilder->addMissingPrices($priceProductValue)->shouldBeCalled();
$this->initialize();
$this->getCommonAttributes()->shouldReturn([$name, $price]);
$this->getValues()->shouldHaveCount(2);
}