Skip to content

Commit 75c8351

Browse files
author
Bohdan Berezhniy
committed
in order to get localization via api
1 parent 52f1887 commit 75c8351

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

Model/AuthorRepository.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ public function getById($authorId, $editMode = false, $storeId = null, $forceRel
128128
$cacheKey = implode('_', func_get_args());
129129
if (!isset($this->instances[$cacheKey])) {
130130
$author = $this->authorFactory->create();
131+
132+
if ($storeId) {
133+
$author->setStoreId($storeId);
134+
}
135+
131136
$this->authorResourceModel->load($author, $authorId);
132137
if (!$author->getId()) {
133138
throw new NoSuchEntityException(__('Requested item doesn\'t exist'));

Model/CategoryRepository.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ public function getById($categoryId, $editMode = false, $storeId = null, $forceR
127127
$cacheKey = implode('_', func_get_args());
128128
if (!isset($this->instances[$cacheKey])) {
129129
$category = $this->categoryFactory->create();
130+
131+
if ($storeId) {
132+
$category->setStoreId($storeId);
133+
}
134+
130135
$this->categoryResourceModel->load($category, $categoryId);
131136
if (!$category->getId()) {
132137
throw new NoSuchEntityException(__('Requested item doesn\'t exist'));

Model/TagRepository.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ public function save(Tag $tag)
120120
public function getById($tagId, $editMode = false, $storeId = null, $forceReload = false)
121121
{
122122
$tag = $this->tagFactory->create();
123+
124+
if ($storeId) {
125+
$tag->setStoreId($storeId);
126+
}
127+
123128
$this->tagResourceModel->load($tag, $tagId);
124129
if (!$tag->getId()) {
125130
throw new NoSuchEntityException(__('Requested item doesn\'t exist'));

0 commit comments

Comments
 (0)