/** * @param string $categoryName * @param \Generated\Shared\Transfer\LocaleTransfer $locale * * @throws \Spryker\Zed\Category\Business\Exception\MissingCategoryException * * @return int */ public function getCategoryIdentifier($categoryName, LocaleTransfer $locale) { $categoryQuery = $this->queryContainer->queryCategoryAttributesByName($categoryName, $locale->getIdLocale()); $category = $categoryQuery->findOne(); if (!$category) { throw new MissingCategoryException(sprintf('Tried to retrieve missing attributes of category %s, locale %s', $categoryName, $locale->getLocaleName())); } return $category->getFkCategory(); }