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


PHP AttributeRepositoryInterface::getIdentifierCode方法代码示例

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


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

示例1: getMissingChannelCodes

 /**
  * @param FamilyInterface $family
  *
  * @return string[]
  */
 protected function getMissingChannelCodes(FamilyInterface $family)
 {
     $requirements = $family->getAttributeRequirements();
     $identifierCode = $this->attributeRepository->getIdentifierCode();
     $currentChannelCodes = [];
     foreach ($requirements as $requirement) {
         if ($requirement->getAttributeCode() === $identifierCode) {
             $currentChannelCodes[] = $requirement->getChannelCode();
         }
     }
     $expectedChannelCodes = $this->channelRepository->getChannelCodes();
     $missingChannelCodes = array_diff($expectedChannelCodes, $currentChannelCodes);
     return $missingChannelCodes;
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:19,代码来源:FamilyRequirementsValidator.php

示例2: getIdentifierCode

 /**
  * @return string
  */
 protected function getIdentifierCode()
 {
     if (null === $this->identifierCode) {
         $this->identifierCode = $this->attributeRepository->getIdentifierCode();
     }
     return $this->identifierCode;
 }
开发者ID:qrz-io,项目名称:ExcelConnectorBundle,代码行数:10,代码来源:SpreadsheetReader.php

示例3: generate

 /**
  * {@inheritdoc}
  */
 public function generate(array $config, $outputDir, ProgressHelper $progress, array $options = null)
 {
     $this->tmpFile = tempnam(sys_get_temp_dir(), 'data-gene');
     if (!empty($config['filename'])) {
         $this->outputFile = $outputDir . '/' . trim($config['filename']);
     } else {
         $this->outputFile = $outputDir . '/' . self::DEFAULT_FILENAME;
     }
     $count = (int) $config['count'];
     $nbAttrBase = (int) $config['filled_attributes_count'];
     $nbAttrDeviation = (int) $config['filled_attributes_standard_deviation'];
     $startIndex = (int) $config['start_index'];
     $categoriesCount = (int) $config['categories_count'];
     $mandatoryAttributes = $config['mandatory_attributes'];
     if (!is_array($mandatoryAttributes)) {
         $mandatoryAttributes = [];
     }
     $delimiter = $config['delimiter'];
     $this->delimiter = $delimiter != null ? $delimiter : self::DEFAULT_DELIMITER;
     if (isset($config['force_values'])) {
         $this->forcedValues = $config['force_values'];
     } else {
         $this->forcedValues = [];
     }
     $this->identifierCode = $this->attributeRepository->getIdentifierCode();
     $this->faker = Faker\Factory::create();
     for ($i = $startIndex; $i < $startIndex + $count; $i++) {
         $product = [];
         $product[$this->identifierCode] = self::IDENTIFIER_PREFIX . $i;
         $family = $this->getRandomFamily($this->faker);
         $product['family'] = $family->getCode();
         if ($nbAttrBase > 0) {
             if ($nbAttrDeviation > 0) {
                 $nbAttr = $this->faker->numberBetween($nbAttrBase - round($nbAttrDeviation / 2), $nbAttrBase + round($nbAttrDeviation / 2));
             } else {
                 $nbAttr = $nbAttrBase;
             }
         }
         $familyAttrCount = count($this->getAttributesFromFamily($family));
         if (!isset($nbAttr) || $nbAttr > $familyAttrCount) {
             $nbAttr = $familyAttrCount;
         }
         $attributes = $this->getRandomAttributesFromFamily($family, $nbAttr);
         foreach ($attributes as $attribute) {
             $valueData = $this->generateValue($attribute);
             $product = array_merge($product, $valueData);
         }
         foreach ($mandatoryAttributes as $mandatoryAttribute) {
             if (isset($this->attributesByFamily[$family->getCode()][$mandatoryAttribute])) {
                 $attribute = $this->attributesByFamily[$family->getCode()][$mandatoryAttribute];
                 $valueData = $this->generateValue($attribute);
                 $product = array_merge($product, $valueData);
             }
         }
         $categories = $this->getRandomCategoryCodes($categoriesCount);
         $product[self::CATEGORY_FIELD] = implode(',', $categories);
         $this->bufferizeProduct($product);
         $progress->advance();
     }
     $this->writeCsvFile();
     unlink($this->tmpFile);
     return $this;
 }
开发者ID:norfil,项目名称:DataGeneratorBundle,代码行数:66,代码来源:ProductGenerator.php

示例4: getIdentifierProperties

 /**
  * {@inheritdoc}
  */
 public function getIdentifierProperties()
 {
     return array($this->attributeRepository->getIdentifierCode());
 }
开发者ID:paulclarkin,项目名称:pim-community-dev,代码行数:7,代码来源:ProductRepository.php

示例5: isAttribute

 /**
  * @param string $code
  *
  * @return bool
  */
 protected function isAttribute($code)
 {
     return null !== $this->attributeRepository->getIdentifierCode($code);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:9,代码来源:VariantGroupStandardConverter.php

示例6: __construct

 /**
  * @param ProductRepositoryInterface   $productRepository
  * @param AttributeRepositoryInterface $attributeRepository
  */
 public function __construct(ProductRepositoryInterface $productRepository, AttributeRepositoryInterface $attributeRepository)
 {
     $this->attributeRepository = $attributeRepository;
     $this->identifierCode = $attributeRepository->getIdentifierCode();
 }
开发者ID:norfil,项目名称:DataGeneratorBundle,代码行数:9,代码来源:AssociationCsvGenerator.php


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