/** * @return GroupInterface */ protected function getGroup() { $groupId = $this->request->get('id', null); if (!$groupId) { $groupId = $this->requestParams->get('currentGroup', null); } $group = $this->groupRepository->find($groupId); return $group; }
/** * Find a variant group by its id or return a 404 response * * @param int $id * * @throws NotFoundHttpException * * @return GroupInterface */ protected function findVariantGroupOr404($id) { $group = $this->groupRepository->find($id); if (!$group || !$group->getType()->isVariant()) { throw new NotFoundHttpException(sprintf('Variant group with id %d could not be found.', $id)); } return $group; }
/** * @return array */ protected function getAttributeIdsFromProductGroupAxes() { $attributeIds = []; if (null !== ($productGroupId = $this->getProductGroupId()) && null !== $this->productGroupRepository) { $group = $this->productGroupRepository->find($productGroupId); if ($group->getType()->isVariant()) { foreach ($group->getAxisAttributes() as $axis) { $attributeIds[] = $axis->getId(); } } } return $attributeIds; }