本文整理汇总了PHP中Pim\Bundle\CatalogBundle\Model\ProductValueInterface::getEntity方法的典型用法代码示例。如果您正苦于以下问题:PHP ProductValueInterface::getEntity方法的具体用法?PHP ProductValueInterface::getEntity怎么用?PHP ProductValueInterface::getEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pim\Bundle\CatalogBundle\Model\ProductValueInterface
的用法示例。
在下文中一共展示了ProductValueInterface::getEntity方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: markAttributeAsUpdatedByVariant
/**
* Mark attribute as variant
*
* @param FormView $view
* @param ProductValueInterface $value
*/
protected function markAttributeAsUpdatedByVariant(FormView $view, ProductValueInterface $value)
{
$view->vars['from_variant'] = $value->getEntity()->getVariantGroup();
$view->vars['disabled'] = true;
$view->vars['read_only'] = true;
foreach ($view as $child) {
$this->markAttributeAsUpdatedByVariant($child, $value);
}
}
示例3:
function it_generates_the_path_when_no_identifier_is_provided(ProductValueInterface $value, ProductInterface $product, FileInfoInterface $fileInfo, AttributeInterface $attribute)
{
$value->getMedia()->willReturn($fileInfo);
$value->getAttribute()->willReturn($attribute);
$value->getEntity()->willReturn($product);
$product->getIdentifier()->willReturn('sku-product');
$fileInfo->getOriginalFilename()->willReturn('file.jpg');
$attribute->getCode()->willReturn('picture');
$attribute->isLocalizable()->willReturn(false);
$attribute->isScopable()->willReturn(false);
$this->generate($value, ['identifier' => null])->shouldReturn('files/sku-product/picture/file.jpg');
}
示例4: valueExists
/**
* {@inheritdoc}
*/
public function valueExists(ProductValueInterface $value)
{
$productQueryBuilder = $this->queryBuilderFactory->create();
$qb = $productQueryBuilder->getQueryBuilder();
$productQueryBuilder->addFilter($value->getAttribute()->getCode(), '=', $value->getData());
$result = $qb->hydrate(false)->getQuery()->execute();
if (0 === $result->count() || 1 === $result->count() && $value->getEntity()->getId() === (string) $result->getNext()['_id']) {
return false;
}
return true;
}
示例5:
function it_marks_product_as_updated_when_a_product_value_is_updated(EntityManager $em, ProductInterface $product, ProductValueInterface $value)
{
$value->getEntity()->willReturn($product);
$this->guessUpdates($em, $value, UpdateGuesserInterface::ACTION_UPDATE_ENTITY)->shouldReturn([$product]);
}