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


PHP AttributeRepositoryInterface::getIdentifier方法代码示例

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


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

示例1: resolveIdentifierField

 /**
  * @return string
  */
 public function resolveIdentifierField()
 {
     if (empty($this->identifierField)) {
         $attribute = $this->attributeRepository->getIdentifier();
         $this->identifierField = $attribute->getCode();
     }
     return $this->identifierField;
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:11,代码来源:AttributeColumnsResolver.php

示例2: validate

 /**
  * Don't allow creating an identifier attribute if one already exists
  *
  * @param AttributeInterface $attribute
  * @param Constraint         $constraint
  */
 public function validate($attribute, Constraint $constraint)
 {
     if ($attribute->getAttributeType() === 'pim_catalog_identifier') {
         $identifier = $this->attributeRepository->getIdentifier();
         if ($identifier && $identifier->getId() !== $attribute->getId()) {
             $this->context->addViolationAt('attributeType', $constraint->message);
         }
     }
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:15,代码来源:SingleIdentifierAttributeValidator.php

示例3: validate

 /**
  * Don't allow creating an identifier attribute if one already exists
  *
  * @param AttributeInterface $attribute
  * @param Constraint         $constraint
  */
 public function validate($attribute, Constraint $constraint)
 {
     if (AttributeTypes::IDENTIFIER === $attribute->getAttributeType()) {
         $identifier = $this->attributeRepository->getIdentifier();
         if ($identifier && $identifier->getId() !== $attribute->getId()) {
             $this->context->buildViolation($constraint->message)->atPath('attributeType')->addViolation();
         }
     }
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:15,代码来源:SingleIdentifierAttributeValidator.php

示例4: createFamily

 /**
  * @return FamilyInterface
  */
 public function createFamily()
 {
     $family = new $this->familyClass();
     $identifier = $this->attributeRepository->getIdentifier();
     $family->addAttribute($identifier);
     $family->setAttributeAsLabel($identifier);
     foreach ($this->getChannels() as $channel) {
         $requirement = $this->factory->createAttributeRequirement($identifier, $channel, true);
         $family->addAttributeRequirement($requirement);
     }
     return $family;
 }
开发者ID:qrz-io,项目名称:pim-community-dev,代码行数:15,代码来源:FamilyFactory.php

示例5: createProduct

 /**
  * {@inheritdoc}
  */
 public function createProduct($identifier = null, $familyCode = null)
 {
     $product = new $this->productClass();
     $identifierAttribute = $this->attributeRepository->getIdentifier();
     $productValue = $this->createProductValue($identifierAttribute);
     $product->addValue($productValue);
     if (null !== $identifier) {
         $productValue->setData($identifier);
     }
     if (null !== $familyCode) {
         $family = $this->familyRepository->findOneByIdentifier($familyCode);
         $product->setFamily($family);
     }
     $event = new GenericEvent($product);
     $this->eventDispatcher->dispatch(ProductEvents::CREATE, $event);
     return $product;
 }
开发者ID:qrz-io,项目名称:pim-community-dev,代码行数:20,代码来源:ProductBuilder.php

示例6: addMissingIdentifierRequirements

 /**
  * @param FamilyInterface $family
  * @param array           $requirements
  *
  * @return array
  */
 protected function addMissingIdentifierRequirements(FamilyInterface $family, array $requirements)
 {
     $channelCodes = $this->channelRepository->getChannelCodes();
     $existingChannelCode = [];
     foreach ($requirements as $requirement) {
         if (AttributeTypes::IDENTIFIER === $requirement->getAttribute()->getAttributeType()) {
             $existingChannelCode[] = $requirement->getChannelCode();
         }
     }
     $missingChannelCodes = array_diff($channelCodes, $existingChannelCode);
     $identifier = $this->attributeRepository->getIdentifier();
     foreach ($missingChannelCodes as $channelCode) {
         $requirements[] = $this->createAttributeRequirement($identifier, $family, $channelCode);
     }
     return $requirements;
 }
开发者ID:qrz-io,项目名称:pim-community-dev,代码行数:22,代码来源:FamilyUpdater.php

示例7:

 function it_provides_the_identifier_attribute(AttributeRepositoryInterface $attributeRepository, AttributeInterface $sku)
 {
     $attributeRepository->getIdentifier()->shouldBeCalled();
     $this->getIdentifierAttribute();
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:5,代码来源:ProductManagerSpec.php

示例8: getIdentifierAttribute

 /**
  * Return the identifier attribute
  *
  * @return AttributeInterface|null
  *
  * @deprecated will be removed in 1.5, please use AttributeRepositoryInterface::getIdentifier();
  */
 public function getIdentifierAttribute()
 {
     return $this->attributeRepository->getIdentifier();
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:11,代码来源:ProductManager.php

示例9: it_should_not_remove_identifier_requirements_when_other_requirements_are_provided

 public function it_should_not_remove_identifier_requirements_when_other_requirements_are_provided($attrRequiFactory, $channelRepository, FamilyInterface $family, AttributeRepositoryInterface $attributeRepository, AttributeInterface $skuAttribute, AttributeInterface $nameAttribute, AttributeInterface $descAttribute, AttributeRequirementInterface $skuMobileRqrmt, AttributeRequirementInterface $skuPrintRqrmt, AttributeRequirementInterface $namePrintRqrmt, AttributeRequirementInterface $descPrintRqrmt, ChannelInterface $mobileChannel, ChannelInterface $printChannel)
 {
     $values = ['code' => 'mycode', 'requirements' => ['print' => ['name', 'description']]];
     $family->getAttributeRequirements()->willReturn([$skuMobileRqrmt, $skuPrintRqrmt]);
     $skuMobileRqrmt->getAttribute()->willReturn($skuAttribute);
     $skuPrintRqrmt->getAttribute()->willReturn($skuAttribute);
     $skuMobileRqrmt->getChannelCode()->willReturn('mobile');
     $skuPrintRqrmt->getChannelCode()->willReturn('print');
     $skuAttribute->getAttributeType()->willReturn(AttributeTypes::IDENTIFIER);
     $channelRepository->findOneByIdentifier('print')->willReturn($printChannel);
     $attributeRepository->findOneByIdentifier('name')->willReturn($nameAttribute);
     $attributeRepository->findOneByIdentifier('description')->willReturn($descAttribute);
     $attrRequiFactory->createAttributeRequirement($nameAttribute, $printChannel, true)->willReturn($namePrintRqrmt);
     $attrRequiFactory->createAttributeRequirement($descAttribute, $printChannel, true)->willReturn($descPrintRqrmt);
     $namePrintRqrmt->getAttribute()->willReturn($nameAttribute);
     $descPrintRqrmt->getAttribute()->willReturn($descAttribute);
     $channelRepository->getChannelCodes()->willReturn(['mobile', 'print']);
     $channelRepository->findOneByIdentifier('mobile')->willReturn($mobileChannel);
     $channelRepository->findOneByIdentifier('print')->willReturn($printChannel);
     $attributeRepository->getIdentifier()->willReturn($skuAttribute);
     $family->setCode('mycode')->shouldBeCalled();
     $family->setAttributeRequirements([$skuMobileRqrmt, $skuPrintRqrmt, $namePrintRqrmt, $descPrintRqrmt])->shouldBeCalled();
     $this->update($family, $values, []);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:24,代码来源:FamilyUpdaterSpec.php


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