File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
app/code/Magento/MediaContentCatalog/Model/ResourceModel Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 1111use Magento \Catalog \Api \CategoryRepositoryInterface ;
1212use Magento \Framework \App \ResourceConnection ;
1313use Magento \Framework \Exception \LocalizedException ;
14+ use Magento \Framework \Exception \NoSuchEntityException ;
1415use Magento \MediaContentApi \Model \GetAssetIdsByContentFieldInterface ;
1516use Magento \Store \Api \GroupRepositoryInterface ;
1617use Magento \Store \Api \StoreRepositoryInterface ;
@@ -70,9 +71,13 @@ public function __construct(
7071 */
7172 public function execute (string $ value ): array
7273 {
73- $ storeView = $ this ->storeRepository ->getById ($ value );
74- $ storeGroup = $ this ->storeGroupRepository ->get ($ storeView ->getStoreGroupId ());
75- $ rootCategory = $ this ->categoryRepository ->get ($ storeGroup ->getRootCategoryId ());
74+ try {
75+ $ storeView = $ this ->storeRepository ->getById ($ value );
76+ $ storeGroup = $ this ->storeGroupRepository ->get ($ storeView ->getStoreGroupId ());
77+ $ rootCategory = $ this ->categoryRepository ->get ($ storeGroup ->getRootCategoryId ());
78+ } catch (NoSuchEntityException $ exception ) {
79+ return [];
80+ }
7681
7782 $ sql = $ this ->connection ->getConnection ()->select ()->from (
7883 ['asset_content_table ' => $ this ->connection ->getTableName (self ::TABLE_CONTENT_ASSET )],
You can’t perform that action at this time.
0 commit comments