Skip to content

Commit 79705a7

Browse files
authored
merge magento/2.3.4-develop into magento-trigger/MC-21671
2 parents 47385e5 + d9df1c2 commit 79705a7

File tree

32 files changed

+693
-106
lines changed

32 files changed

+693
-106
lines changed

app/code/Magento/CatalogGraphQl/Model/Resolver/Product/EntityIdToId.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function resolve(
5353
$product = $value['model'];
5454

5555
$productId = $product->getData(
56-
$this->metadataPool->getMetadata(ProductInterface::class)->getLinkField()
56+
$this->metadataPool->getMetadata(ProductInterface::class)->getIdentifierField()
5757
);
5858

5959
return $productId;

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\
100100
created_at: String @doc(description: "Timestamp indicating when the product was created.")
101101
updated_at: String @doc(description: "Timestamp indicating when the product was updated.")
102102
country_of_manufacture: String @doc(description: "The product's country of origin.")
103-
type_id: String @doc(description: "One of simple, virtual, bundle, downloadable, grouped, or configurable.")
104-
websites: [Website] @doc(description: "An array of websites in which the product is available.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\Websites")
103+
type_id: String @doc(description: "One of simple, virtual, bundle, downloadable, grouped, or configurable.") @deprecated(reason: "Use __typename instead.")
104+
websites: [Website] @doc(description: "An array of websites in which the product is available.") @deprecated(reason: "The field should not be used on the storefront.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\Websites")
105105
product_links: [ProductLinksInterface] @doc(description: "An array of ProductLinks objects.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\BatchProductLinks")
106106
media_gallery_entries: [MediaGalleryEntry] @deprecated(reason: "Use product's `media_gallery` instead") @doc(description: "An array of MediaGalleryEntry objects.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\MediaGalleryEntries")
107107
price: ProductPrices @deprecated(reason: "Use price_range for product price information.") @doc(description: "A ProductPrices object, indicating the price of an item.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\Price")

app/code/Magento/Checkout/Model/Session.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ public function getQuote()
273273
*/
274274
$quote = $this->quoteRepository->get($this->getQuoteId());
275275
}
276+
277+
if ($quote->getTotalsCollectedFlag() === false) {
278+
$quote->collectTotals();
279+
}
276280
} catch (NoSuchEntityException $e) {
277281
$this->setQuoteId(null);
278282
}

app/code/Magento/MediaGallery/Model/Asset/Command/DeleteByPath.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
namespace Magento\MediaGallery\Model\Asset\Command;
99

10-
use Magento\MediaGalleryApi\Model\Asset\Command\DeleteByPathInterface;
1110
use Magento\Framework\App\ResourceConnection;
12-
use Magento\Framework\Exception\CouldNotDeleteException;
1311
use Magento\Framework\DB\Adapter\AdapterInterface;
12+
use Magento\Framework\Exception\CouldNotDeleteException;
13+
use Magento\MediaGalleryApi\Model\Asset\Command\DeleteByPathInterface;
1414
use Psr\Log\LoggerInterface;
1515

1616
/**
@@ -62,11 +62,11 @@ public function execute(string $mediaAssetPath): void
6262
$tableName = $this->resourceConnection->getTableName(self::TABLE_MEDIA_GALLERY_ASSET);
6363
$connection->delete($tableName, [self::MEDIA_GALLERY_ASSET_PATH . ' = ?' => $mediaAssetPath]);
6464
} catch (\Exception $exception) {
65+
$this->logger->critical($exception);
6566
$message = __(
6667
'Could not delete media asset with path %path: %error',
6768
['path' => $mediaAssetPath, 'error' => $exception->getMessage()]
6869
);
69-
$this->logger->critical($message);
7070
throw new CouldNotDeleteException($message, $exception);
7171
}
7272
}

app/code/Magento/MediaGallery/Model/Asset/Command/GetById.php

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
namespace Magento\MediaGallery\Model\Asset\Command;
99

10-
use Magento\MediaGalleryApi\Api\Data\AssetInterface;
11-
use Magento\MediaGalleryApi\Api\Data\AssetInterfaceFactory;
12-
use Magento\MediaGalleryApi\Model\Asset\Command\GetByIdInterface;
1310
use Magento\Framework\App\ResourceConnection;
1411
use Magento\Framework\Exception\IntegrationException;
1512
use Magento\Framework\Exception\NoSuchEntityException;
13+
use Magento\MediaGalleryApi\Api\Data\AssetInterface;
14+
use Magento\MediaGalleryApi\Api\Data\AssetInterfaceFactory;
15+
use Magento\MediaGalleryApi\Model\Asset\Command\GetByIdInterface;
1616
use Psr\Log\LoggerInterface;
1717

1818
/**
@@ -66,24 +66,34 @@ public function __construct(
6666
public function execute(int $mediaAssetId): AssetInterface
6767
{
6868
try {
69+
$mediaAssetTable = $this->resourceConnection->getTableName(self::TABLE_MEDIA_GALLERY_ASSET);
6970
$connection = $this->resourceConnection->getConnection();
7071
$select = $connection->select()
71-
->from(['amg' => $this->resourceConnection->getTableName(self::TABLE_MEDIA_GALLERY_ASSET)])
72+
->from(['amg' => $mediaAssetTable])
7273
->where('amg.id = ?', $mediaAssetId);
73-
$data = $connection->query($select)->fetch();
74+
$mediaAssetData = $connection->query($select)->fetch();
75+
} catch (\Exception $exception) {
76+
$message = __(
77+
'En error occurred during get media asset data by id %id: %error',
78+
['id' => $mediaAssetId, 'error' => $exception->getMessage()]
79+
);
80+
$this->logger->critical($message);
81+
throw new IntegrationException($message, $exception);
82+
}
7483

75-
if (empty($data)) {
76-
$message = __('There is no such media asset with id "%1"', $mediaAssetId);
77-
throw new NoSuchEntityException($message);
78-
}
84+
if (empty($mediaAssetData)) {
85+
$message = __('There is no such media asset with id "%1"', $mediaAssetId);
86+
throw new NoSuchEntityException($message);
87+
}
7988

80-
return $this->assetFactory->create(['data' => $data]);
89+
try {
90+
return $this->assetFactory->create(['data' => $mediaAssetData]);
8191
} catch (\Exception $exception) {
92+
$this->logger->critical($exception->getMessage());
8293
$message = __(
83-
'En error occurred during get media asset with id %id by id: %error',
94+
'En error occurred during initialize media asset with id %id: %error',
8495
['id' => $mediaAssetId, 'error' => $exception->getMessage()]
8596
);
86-
$this->logger->critical($message);
8797
throw new IntegrationException($message, $exception);
8898
}
8999
}

app/code/Magento/MediaGallery/Model/Asset/Command/GetByPath.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ public function execute(string $mediaFilePath): AssetInterface
8282

8383
return $mediaAssets;
8484
} catch (\Exception $exception) {
85+
$this->logger->critical($exception);
8586
$message = __('An error occurred during get media asset list: %1', $exception->getMessage());
86-
$this->logger->critical($message);
8787
throw new IntegrationException($message, $exception);
8888
}
8989
}

app/code/Magento/MediaGallery/Model/Asset/Command/Save.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ public function execute(AssetInterface $mediaAsset): int
7171
$connection->insertOnDuplicate($tableName, $this->extractor->extract($mediaAsset, AssetInterface::class));
7272
return (int) $connection->lastInsertId($tableName);
7373
} catch (\Exception $exception) {
74+
$this->logger->critical($exception);
7475
$message = __('An error occurred during media asset save: %1', $exception->getMessage());
75-
$this->logger->critical($message);
7676
throw new CouldNotSaveException($message, $exception);
7777
}
7878
}

app/code/Magento/MediaGallery/Model/DataExtractor.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
class DataExtractor implements DataExtractorInterface
1616
{
1717
/**
18-
* @inheritdoc
18+
* Extract data from an object using available getters (does not process extension attributes)
19+
*
20+
* @param object $object
21+
* @param string|null $interface
22+
*
23+
* @return array
24+
* @throws \ReflectionException
1925
*/
2026
public function extract($object, string $interface = null): array
2127
{

app/code/Magento/MediaGallery/Model/Keyword/Command/GetAssetKeywords.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77

88
namespace Magento\MediaGallery\Model\Keyword\Command;
99

10+
use Magento\Framework\Exception\IntegrationException;
1011
use Magento\MediaGalleryApi\Api\Data\KeywordInterface;
1112
use Magento\MediaGalleryApi\Api\Data\KeywordInterfaceFactory;
1213
use Magento\MediaGalleryApi\Model\Keyword\Command\GetAssetKeywordsInterface;
1314
use Magento\Framework\App\ResourceConnection;
14-
use Magento\Framework\Exception\NotFoundException;
15+
use Psr\Log\LoggerInterface;
1516

1617
/**
1718
* ClassGetAssetKeywords
@@ -31,27 +32,35 @@ class GetAssetKeywords implements GetAssetKeywordsInterface
3132
*/
3233
private $assetKeywordFactory;
3334

35+
/**
36+
* @var LoggerInterface
37+
*/
38+
private $logger;
39+
3440
/**
3541
* GetAssetKeywords constructor.
3642
*
3743
* @param ResourceConnection $resourceConnection
3844
* @param KeywordInterfaceFactory $assetKeywordFactory
45+
* @param LoggerInterface $logger
3946
*/
4047
public function __construct(
4148
ResourceConnection $resourceConnection,
42-
KeywordInterfaceFactory $assetKeywordFactory
49+
KeywordInterfaceFactory $assetKeywordFactory,
50+
LoggerInterface $logger
4351
) {
4452
$this->resourceConnection = $resourceConnection;
4553
$this->assetKeywordFactory = $assetKeywordFactory;
54+
$this->logger = $logger;
4655
}
4756

4857
/**
4958
* Get asset related keywords.
5059
*
5160
* @param int $assetId
5261
*
53-
* @return KeywordInterface[]
54-
* @throws NotFoundException
62+
* @return KeywordInterface[]|[]
63+
* @throws IntegrationException
5564
*/
5665
public function execute(int $assetId): array
5766
{
@@ -71,8 +80,9 @@ public function execute(int $assetId): array
7180

7281
return $keywords;
7382
} catch (\Exception $exception) {
83+
$this->logger->critical($exception);
7484
$message = __('An error occurred during get asset keywords: %1', $exception->getMessage());
75-
throw new NotFoundException($message, $exception);
85+
throw new IntegrationException($message, $exception);
7686
}
7787
}
7888
}

app/code/Magento/MediaGallery/Model/Keyword/Command/SaveAssetKeywords.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Framework\DB\Adapter\AdapterInterface;
1414
use Magento\Framework\DB\Adapter\Pdo\Mysql;
1515
use Magento\Framework\Exception\CouldNotSaveException;
16+
use Psr\Log\LoggerInterface;
1617

1718
/**
1819
* Class SaveAssetKeywords
@@ -33,22 +34,34 @@ class SaveAssetKeywords implements SaveAssetKeywordsInterface
3334
*/
3435
private $saveAssetLinks;
3536

37+
/**
38+
* @var LoggerInterface
39+
*/
40+
private $logger;
41+
3642
/**
3743
* SaveAssetKeywords constructor.
3844
*
3945
* @param ResourceConnection $resourceConnection
4046
* @param SaveAssetLinks $saveAssetLinks
47+
* @param LoggerInterface $logger
4148
*/
4249
public function __construct(
4350
ResourceConnection $resourceConnection,
44-
SaveAssetLinks $saveAssetLinks
51+
SaveAssetLinks $saveAssetLinks,
52+
LoggerInterface $logger
4553
) {
4654
$this->resourceConnection = $resourceConnection;
4755
$this->saveAssetLinks = $saveAssetLinks;
56+
$this->logger = $logger;
4857
}
4958

5059
/**
51-
* @inheritdoc
60+
* Save asset keywords.
61+
*
62+
* @param KeywordInterface[] $keywords
63+
* @param int $assetId
64+
* @throws CouldNotSaveException
5265
*/
5366
public function execute(array $keywords, int $assetId): void
5467
{
@@ -72,6 +85,7 @@ public function execute(array $keywords, int $assetId): void
7285
$this->saveAssetLinks->execute($assetId, $this->getKeywordIds($data));
7386
}
7487
} catch (\Exception $exception) {
88+
$this->logger->critical($exception);
7589
$message = __('An error occurred during save asset keyword: %1', $exception->getMessage());
7690
throw new CouldNotSaveException($message, $exception);
7791
}

0 commit comments

Comments
 (0)