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


PHP AttributeRepositoryInterface::findBy方法代码示例

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


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

示例1: indexAction

 /**
  * Get the attribute collection.
  *
  * TODO This action is only accessible via a GET or POST query, because of too long query URI. To respect standards,
  * a refactor must be done.
  *
  * @param Request $request
  *
  * @return JsonResponse
  */
 public function indexAction(Request $request)
 {
     $options = [];
     $context = ['include_group' => true];
     if ($request->request->has('identifiers')) {
         $options['identifiers'] = explode(',', $request->request->get('identifiers'));
         $context['include_group'] = false;
     }
     if ($request->request->has('types')) {
         $options['types'] = explode(',', $request->request->get('types'));
     }
     if (empty($options)) {
         $options = $request->request->get('options', ['limit' => SearchableRepositoryInterface::FETCH_LIMIT, 'locale' => null]);
     }
     $token = $this->tokenStorage->getToken();
     $options['user_groups_ids'] = $token->getUser()->getGroupsIds();
     if (null !== $this->attributeSearchRepository) {
         $attributes = $this->attributeSearchRepository->findBySearch($request->request->get('search'), $options);
     } else {
         if (isset($options['identifiers'])) {
             $options['code'] = $options['identifiers'];
         }
         $attributes = $this->attributeRepository->findBy($options);
     }
     $normalizedAttributes = $this->normalizer->normalize($attributes, 'internal_api', $context);
     return new JsonResponse($normalizedAttributes);
 }
开发者ID:SamirBoulil,项目名称:pim-community-dev,代码行数:37,代码来源:AttributeController.php

示例2: getFieldsList

 /**
  * Get fields for products
  *
  * @param array $productIds
  *
  * @return array
  */
 public function getFieldsList($productIds)
 {
     $this->prepareAvailableAttributeIds($productIds);
     $attributes = $this->getAttributeIds();
     if (empty($attributes)) {
         return [];
     }
     $attributes = $this->attributeRepository->findBy(['id' => $this->getAttributeIds()]);
     return $this->prepareFieldsList($attributes);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:17,代码来源:ProductFieldsBuilder.php

示例3: indexAction

 /**
  * Get the attribute collection
  *
  * @return JsonResponse
  */
 public function indexAction(Request $request)
 {
     $criteria = [];
     if ($request->query->has('identifiers')) {
         $criteria['code'] = explode(',', $request->query->get('identifiers'));
     }
     if ($request->query->has('types')) {
         $criteria['attributeType'] = explode(',', $request->query->get('types'));
     }
     $attributes = $this->attributeRepository->findBy($criteria);
     $filteredAttributes = $this->collectionFilter->filterCollection($attributes, 'pim.internal_api.attribute.view');
     $normalizedAttributes = $this->normalizer->normalize($filteredAttributes, 'internal_api');
     return new JsonResponse($normalizedAttributes);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:19,代码来源:AttributeController.php

示例4: getNonEligibleAttributes

 /**
  * Get non eligible attributes to a product template
  *
  * @param GroupInterface $variantGroup
  *
  * @return AttributeInterface[]
  */
 public function getNonEligibleAttributes(GroupInterface $variantGroup)
 {
     $attributes = $variantGroup->getAxisAttributes()->toArray();
     $template = $variantGroup->getProductTemplate();
     if (null !== $template) {
         foreach (array_keys($template->getValuesData()) as $attributeCode) {
             $attributes[] = $this->attributeRepository->findOneByIdentifier($attributeCode);
         }
     }
     $uniqueAttributes = $this->attributeRepository->findBy(['unique' => true]);
     foreach ($uniqueAttributes as $attribute) {
         if (!in_array($attribute, $attributes)) {
             $attributes[] = $attribute;
         }
     }
     return $attributes;
 }
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:24,代码来源:VariantGroupAttributesResolver.php


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