File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
app/code/Magento/CatalogUrlRewriteGraphQl/Model/DataProvider/UrlRewrite Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 1111use Magento \Framework \Exception \NoSuchEntityException ;
1212use Magento \Framework \GraphQl \Schema \Type \ResolveInfo ;
1313use Magento \UrlRewriteGraphQl \Model \DataProvider \EntityDataProviderInterface ;
14+ use Magento \Catalog \Model \Product \Attribute \Source \Status ;
15+ use Magento \Framework \GraphQl \Exception \GraphQlNoSuchEntityException ;
1416
1517class ProductDataProvider implements EntityDataProviderInterface
1618{
@@ -36,7 +38,7 @@ public function __construct(
3638 * @param ResolveInfo|null $info
3739 * @param int|null $storeId
3840 * @return array
39- * @throws NoSuchEntityException
41+ * @throws GraphQlNoSuchEntityException| NoSuchEntityException
4042 * @SuppressWarnings(PHPMD.UnusedFormalParameter)
4143 */
4244 public function getData (
@@ -47,6 +49,10 @@ public function getData(
4749 ): array {
4850 $ product = $ this ->productRepository ->getById ($ id , false , $ storeId );
4951 $ result = $ product ->getData ();
52+
53+ if ((int )$ product ->getStatus () !== Status::STATUS_ENABLED ) {
54+ throw new GraphQlNoSuchEntityException (__ ('This product is disabled. ' ));
55+ }
5056 $ result ['model ' ] = $ product ;
5157 return $ result ;
5258 }
You can’t perform that action at this time.
0 commit comments