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


PHP Repository\ProductRepositoryInterface类代码示例

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


在下文中一共展示了ProductRepositoryInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: apply

 /**
  * {@inheritdoc}
  */
 public function apply(DatasourceInterface $datasource, $field, $direction)
 {
     $attribute = $this->attributeRepository->findOneByCode($field);
     $qb = $datasource->getQueryBuilder();
     $pqb = $this->productRepository->getProductQueryBuilder($qb);
     $pqb->addAttributeSorter($attribute, $direction);
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:10,代码来源:ValueSorter.php

示例3: updateProductAssociationExport

 /**
  * Update product association export date for the given product.
  *
  * @param JobInstance $jobInstance
  * @param string      $identifier
  */
 public function updateProductAssociationExport(JobInstance $jobInstance, $identifier)
 {
     $product = $this->productRepository->findByReference((string) $identifier);
     if ($product) {
         $this->updateExport($product, $jobInstance, $this->tableNameBuilder->getTableName('pim_magento_connector.entity.delta_product_association_export.class'));
     }
 }
开发者ID:rskonieczka,项目名称:MagentoConnectorBundle,代码行数:13,代码来源:DeltaProductExportManager.php

示例4: listProductsAction

 /**
  * Display the products of a group
  *
  * @param string $identifier
  *
  * @return JsonResponse
  *
  * @AclAncestor("pim_enrich_product_index")
  */
 public function listProductsAction($identifier)
 {
     $group = $this->groupRepository->findOneBy(['code' => $identifier]);
     if (!$group) {
         throw new NotFoundHttpException(sprintf('Group with code "%s" not found', $identifier));
     }
     return new JsonResponse($this->normalizer->normalize(['products' => $this->productRepository->getProductsByGroup($group, self::MAX_PRODUCTS), 'productCount' => $this->productRepository->getProductCountByGroup($group)], 'internal_api'));
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:17,代码来源:GroupController.php

示例5: findProductOr404

 /**
  * Find a product by its id or return a 404 response
  *
  * @param string $id the product id
  *
  * @throws NotFoundHttpException
  *
  * @return ProductInterface
  */
 protected function findProductOr404($id)
 {
     $product = $this->productRepository->findOneByWithValues($id);
     if (!$product) {
         throw new NotFoundHttpException(sprintf('Product with id %s could not be found.', (string) $id));
     }
     return $product;
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:17,代码来源:ProductCategoryController.php

示例6: completenessAction

 /**
  * Displays completeness for a product
  *
  * @param int $id
  *
  * @return Response
  */
 public function completenessAction($id)
 {
     $product = $this->productRepository->getFullProduct($id);
     $channels = $this->channelManager->getFullChannels();
     $locales = $this->userContext->getUserLocales();
     $completenesses = $this->completenessManager->getProductCompleteness($product, $channels, $locales, $this->userContext->getCurrentLocale()->getCode());
     return $this->templating->renderResponse('PimEnrichBundle:Completeness:_completeness.html.twig', ['product' => $product, 'channels' => $channels, 'locales' => $locales, 'completenesses' => $completenesses]);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:15,代码来源:CompletenessController.php

示例7: findProductOr404

 /**
  * Find a product by its id or return a 404 response
  *
  * @param int $id the product id
  *
  * @throws NotFoundHttpException
  *
  * @return ProductInterface
  */
 protected function findProductOr404($id)
 {
     $product = $this->productRepository->findOneById($id);
     if (!$product) {
         throw new NotFoundHttpException(sprintf('Product with id %s could not be found.', $id));
     }
     $this->productBuilder->addMissingAssociations($product);
     return $product;
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:18,代码来源:AssociationController.php

示例8: getAction

 /**
  * Get completeness for a product
  *
  * @param int $id
  *
  * @return JSONResponse
  */
 public function getAction($id)
 {
     $product = $this->productRepository->getFullProduct($id);
     $this->completenessManager->generateMissingForProduct($product);
     $channels = $this->channelRepository->getFullChannels();
     $locales = $this->userContext->getUserLocales();
     $filteredLocales = $this->collectionFilter->filterCollection($locales, 'pim.internal_api.locale.view');
     $completenesses = $this->completenessManager->getProductCompleteness($product, $channels, $filteredLocales, $this->userContext->getCurrentLocale()->getCode());
     return new JsonResponse($this->completenessNormalizer->normalize($completenesses, 'internal_api'));
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:17,代码来源:CompletenessController.php

示例9: apply

 /**
  * {@inheritdoc}
  */
 public function apply(DatasourceInterface $datasource, $field, $direction)
 {
     $qb = $datasource->getQueryBuilder();
     $groupId = $this->requestParams->get('currentGroup', null);
     if (!$groupId) {
         throw new \LogicException('The current product group must be configured');
     }
     $field = 'in_group_' . $groupId;
     $pqb = $this->repository->getProductQueryBuilder($qb);
     $pqb->addFieldSorter($field, $direction);
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:14,代码来源:InGroupSorter.php

示例10: prepareParameters

 /**
  * @return array
  */
 protected function prepareParameters()
 {
     $queryParameters = parent::prepareParameters();
     $variantGroupId = $queryParameters['currentGroup'];
     if (null !== $variantGroupId) {
         $productIds = $this->productRepository->getEligibleProductIdsForVariantGroup($variantGroupId);
         if (count($productIds) === 0) {
             $productIds = [0];
         }
     } else {
         $productIds = [0];
     }
     $queryParameters['productIds'] = $productIds;
     return $queryParameters;
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:18,代码来源:AddParametersToVariantProductGridListener.php

示例11: addCurrentProduct

 /**
  * Inject current product in the datagrid configuration
  */
 protected function addCurrentProduct()
 {
     $path = $this->getSourcePath(self::CURRENT_PRODUCT_KEY);
     $id = $this->requestParams->get('product', null);
     $product = null !== $id ? $this->productRepository->findOneByWithValues($id) : null;
     $this->configuration->offsetSetByPath($path, $product);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:10,代码来源:ContextConfigurator.php

示例12: findEntity

 /**
  * {@inheritdoc}
  */
 protected function findEntity($class, array $data)
 {
     if (!$this->identifierAttribute) {
         throw new MissingIdentifierException();
     }
     return $this->productRepository->findOneByIdentifier($data[$this->identifierAttribute->getCode()]);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:10,代码来源:ProductTransformer.php

示例13: read

 /**
  * {@inheritdoc}
  */
 public function read()
 {
     $this->documentManager->clear();
     if (!$this->executed) {
         $this->executed = true;
         if (!is_object($this->channel)) {
             $this->channel = $this->channelManager->getChannelByCode($this->channel);
         }
         if ($this->missingCompleteness) {
             $this->completenessManager->generateMissingForChannel($this->channel);
         }
         $this->query = $this->repository->buildByChannelAndCompleteness($this->channel)->getQuery();
         $this->products = $this->getQuery()->execute();
         // MongoDB Cursor are not positioned on first element (whereas ArrayIterator is)
         // as long as getNext() hasn't be called
         $this->products->getNext();
     }
     $result = $this->products->current();
     if ($result) {
         $this->metricConverter->convert($result, $this->channel);
         $this->stepExecution->incrementSummaryInfo('read');
         $this->products->next();
     }
     return $result;
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:28,代码来源:ODMProductReader.php

示例14: getMatchingProductsForVariantGroup

 /**
  * Get matching products for variant group
  *
  * @param GroupInterface $variantGroup the variant group
  *
  * @return ProductInterface[]
  */
 protected function getMatchingProductsForVariantGroup(GroupInterface $variantGroup)
 {
     if (!$variantGroup->getId()) {
         return [];
     }
     return $this->repository->findAllForVariantGroup($variantGroup);
 }
开发者ID:SamirBoulil,项目名称:pim-community-dev,代码行数:14,代码来源:UniqueVariantAxisValidator.php

示例15: quickExport

 /**
  * {@inheritdoc}
  */
 protected function quickExport()
 {
     $productIds = $this->massActionDispatcher->dispatch($this->request);
     $fieldsList = $this->fieldsBuilder->getFieldsList($productIds);
     $attributeIds = $this->fieldsBuilder->getAttributeIds();
     $context = $this->getContext() + ['fields' => $fieldsList];
     // batch output to avoid memory leak
     $offset = 0;
     $batchSize = 100;
     while ($productsList = array_slice($productIds, $offset, $batchSize)) {
         $results = $this->productRepository->getFullProducts($productsList, $attributeIds);
         echo $this->serializer->serialize($results, $this->getFormat(), $context);
         $offset += $batchSize;
         flush();
     }
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:19,代码来源:ProductExportController.php


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