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


PHP ProductValueInterface::getEntity方法代码示例

本文整理汇总了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);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:35,代码来源:ProductFormViewSpec.php

示例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);
     }
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:15,代码来源:VariantViewUpdater.php

示例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');
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:12,代码来源:MediaExporterPathGeneratorSpec.php

示例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;
 }
开发者ID:vpetrovych,项目名称:pim-community-dev,代码行数:14,代码来源:ProductRepository.php

示例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]);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:5,代码来源:ProductValueUpdateGuesserSpec.php


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