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 11
11
use Magento \Catalog \Api \CategoryRepositoryInterface ;
12
12
use Magento \Framework \App \ResourceConnection ;
13
13
use Magento \Framework \Exception \LocalizedException ;
14
+ use Magento \Framework \Exception \NoSuchEntityException ;
14
15
use Magento \MediaContentApi \Model \GetAssetIdsByContentFieldInterface ;
15
16
use Magento \Store \Api \GroupRepositoryInterface ;
16
17
use Magento \Store \Api \StoreRepositoryInterface ;
@@ -70,9 +71,13 @@ public function __construct(
70
71
*/
71
72
public function execute (string $ value ): array
72
73
{
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
+ }
76
81
77
82
$ sql = $ this ->connection ->getConnection ()->select ()->from (
78
83
['asset_content_table ' => $ this ->connection ->getTableName (self ::TABLE_CONTENT_ASSET )],
You can’t perform that action at this time.
0 commit comments