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


PHP ProductRepositoryInterface::valueExists方法代码示例

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


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

示例1:

 function it_checks_value_existence(ProductRepositoryInterface $productRepository, ProductValueInterface $value)
 {
     $productRepository->valueExists($value)->willReturn(true);
     $this->valueExists($value)->shouldReturn(true);
     $productRepository->valueExists($value)->willReturn(false);
     $this->valueExists($value)->shouldReturn(false);
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:7,代码来源:ProductManagerSpec.php

示例2: checkUniqueValues

 /**
  * Checks the uniqueness of product values that should be unique
  * As the uniqueness check is normally executed against the database
  * and imported products have not been persisted yet, this effectively
  * checks that the items in the current batch don't contain duplicate values
  * for unique attributes.
  *
  * @param object $entity
  * @param array  $columnsInfo
  * @param array  $data
  *
  * @throws DuplicateProductValueException When duplicate values are encountered
  */
 protected function checkUniqueValues($entity, array $columnsInfo, array $data)
 {
     foreach ($columnsInfo as $columnInfo) {
         if ($columnInfo->getAttribute()) {
             $value = $this->getProductValue($entity, $columnInfo);
             if ($value->getAttribute()->isUnique()) {
                 $code = $value->getAttribute()->getCode();
                 $valueData = (string) $value;
                 if ($valueData !== '') {
                     if ($this->productRepository->valueExists($value)) {
                         throw new DuplicateProductValueException($code, $valueData, $data);
                     }
                     $this->uniqueValues[$code] = isset($this->uniqueValues[$code]) ? $this->uniqueValues[$code] : [];
                     if (isset($this->uniqueValues[$code][$valueData])) {
                         throw new DuplicateProductValueException($code, $valueData, $data);
                     } else {
                         $this->uniqueValues[$code][$valueData] = "";
                     }
                 }
             }
         }
     }
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:36,代码来源:ProductImportValidator.php

示例3: valueExists

 /**
  * Check if a product value with a specific value already exists
  *
  * @param ProductValueInterface $value
  *
  * @return bool
  *
  * @deprecated will be removed in 1.5, please use ProductRepositoryInterface::valueExists
  */
 public function valueExists(ProductValueInterface $value)
 {
     return $this->productRepository->valueExists($value);
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:13,代码来源:ProductManager.php

示例4:

 function it_does_not_validate_with_empty_value(ProductRepositoryInterface $productRepository, ProductValueInterface $value, ExecutionContextInterface $context, Constraint $constraint)
 {
     $productRepository->valueExists($value)->shouldNotBeCalled();
     $context->buildViolation(Argument::any())->shouldNotBeCalled();
     $this->validate("", $constraint)->shouldReturn(null);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:6,代码来源:UniqueValueValidatorSpec.php

示例5: alreadyExists

 /**
  * @param ProductValueInterface $productValue
  *
  * @return bool
  */
 protected function alreadyExists(ProductValueInterface $productValue)
 {
     return $this->repository->valueExists($productValue);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:9,代码来源:UniqueValueValidator.php


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