6 declare(strict_types=1);
27 private $categoryUrlPathGenerator;
32 private $categoryUrlRewriteGenerator;
37 private $storeViewService;
56 $this->categoryUrlPathGenerator = $categoryUrlPathGenerator;
57 $this->categoryUrlRewriteGenerator = $categoryUrlRewriteGenerator;
58 $this->urlPersist = $urlPersist;
59 $this->storeViewService = $storeViewService;
72 CategoryResource $subject,
76 $parentCategoryId =
$category->getParentId();
79 && !empty($parentCategoryId)
82 if (!$this->isGlobalScope((
int)
$storeId)
83 && $this->storeViewService->doesEntityHaveOverriddenUrlPathForStore(
90 $this->updateUrlPathForCategory(
$category, $subject);
91 $this->urlPersist->replace($this->categoryUrlRewriteGenerator->generate(
$category));
105 private function isGlobalScope(
int $storeId): bool
117 private function updateUrlPathForCategory(
Category $category, CategoryResource $categoryResource): void
121 $categoryResource->saveAttribute(
$category,
'url_path');
__construct(CategoryUrlPathGenerator $categoryUrlPathGenerator, CategoryUrlRewriteGenerator $categoryUrlRewriteGenerator, UrlPersistInterface $urlPersist, StoreViewService $storeViewService)
afterSave(CategoryResource $subject, CategoryResource $result, AbstractModel $category)