本文整理匯總了PHP中Pim\Bundle\CatalogBundle\Repository\AttributeRepositoryInterface::findBy方法的典型用法代碼示例。如果您正苦於以下問題:PHP AttributeRepositoryInterface::findBy方法的具體用法?PHP AttributeRepositoryInterface::findBy怎麽用?PHP AttributeRepositoryInterface::findBy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pim\Bundle\CatalogBundle\Repository\AttributeRepositoryInterface
的用法示例。
在下文中一共展示了AttributeRepositoryInterface::findBy方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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);
}
示例2: 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);
}
示例3: getNonEligibleAttributes
/**
* Get non eligible attributes to a product template
*
* @param GroupInterface $group
*
* @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;
}