Skip to content

Commit 6775504

Browse files
committed
Merge remote-tracking branch 'origin/AC-14857' into cia-2.4.9-alpha2-develop-bugfix-07022025
2 parents 3b5091f + 75a4096 commit 6775504

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/code/Magento/CatalogUrlRewriteGraphQl/Model/DataProvider/UrlRewrite/ProductDataProvider.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
use Magento\Framework\Exception\NoSuchEntityException;
1212
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
1313
use Magento\UrlRewriteGraphQl\Model\DataProvider\EntityDataProviderInterface;
14+
use Magento\Catalog\Model\Product\Attribute\Source\Status;
15+
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
1416

1517
class 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
}

0 commit comments

Comments
 (0)