Skip to content

Commit 4e14fb9

Browse files
committed
#27948: Removed metadata pool
1 parent 089d3fb commit 4e14fb9

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

app/code/Magento/MediaContentCatalog/Observer/Category.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
use Magento\MediaContentApi\Api\UpdateContentAssetLinksInterface;
1414
use Magento\MediaContentApi\Api\Data\ContentIdentityInterfaceFactory;
1515
use Magento\MediaContentCatalog\Model\ResourceModel\GetContent;
16-
use Magento\Framework\EntityManager\MetadataPool;
17-
use Magento\Catalog\Api\Data\CategoryInterface;
1816

1917
/**
2018
* Observe the catalog_category_save_after event and run processing relation between category content and media asset.
@@ -26,11 +24,6 @@ class Category implements ObserverInterface
2624
private const ENTITY_ID = 'entityId';
2725
private const FIELD = 'field';
2826

29-
/**
30-
* @var MetadataPool
31-
*/
32-
private $metadataPool;
33-
3427
/**
3528
* @var UpdateContentAssetLinksInterface
3629
*/
@@ -61,13 +54,11 @@ public function __construct(
6154
ContentIdentityInterfaceFactory $contentIdentityFactory,
6255
GetContent $getContent,
6356
UpdateContentAssetLinksInterface $updateContentAssetLinks,
64-
MetadataPool $metadataPool,
6557
array $fields
6658
) {
6759
$this->contentIdentityFactory = $contentIdentityFactory;
6860
$this->getContent = $getContent;
6961
$this->updateContentAssetLinks = $updateContentAssetLinks;
70-
$this->metadataPool = $metadataPool;
7162
$this->fields = $fields;
7263
}
7364

@@ -82,7 +73,6 @@ public function execute(Observer $observer): void
8273
$model = $observer->getEvent()->getData('category');
8374

8475
if ($model instanceof CatalogCategory) {
85-
$id = (int) $model->getData($this->metadataPool->getMetadata(CategoryInterface::class)->getLinkField());
8676
foreach ($this->fields as $field) {
8777
if (!$model->dataHasChangedFor($field)) {
8878
continue;
@@ -95,7 +85,7 @@ public function execute(Observer $observer): void
9585
self::ENTITY_ID => (string) $model->getId(),
9686
]
9787
),
98-
$this->getContent->execute($id, $model->getAttributes()[$field])
88+
$this->getContent->execute((int) $model->getId(), $model->getAttributes()[$field])
9989
);
10090
}
10191
}

app/code/Magento/MediaContentCatalog/Observer/Product.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
use Magento\MediaContentApi\Api\UpdateContentAssetLinksInterface;
1414
use Magento\MediaContentApi\Api\Data\ContentIdentityInterfaceFactory;
1515
use Magento\MediaContentCatalog\Model\ResourceModel\GetContent;
16-
use Magento\Framework\EntityManager\MetadataPool;
17-
use Magento\Catalog\Api\Data\ProductInterface;
1816

1917
/**
2018
* Observe the catalog_product_save_after event and run processing relation between product content and media asset
@@ -26,11 +24,6 @@ class Product implements ObserverInterface
2624
private const ENTITY_ID = 'entityId';
2725
private const FIELD = 'field';
2826

29-
/**
30-
* @var MetadataPool
31-
*/
32-
private $metadataPool;
33-
3427
/**
3528
* @var UpdateContentAssetLinksInterface
3629
*/
@@ -61,10 +54,8 @@ public function __construct(
6154
ContentIdentityInterfaceFactory $contentIdentityFactory,
6255
GetContent $getContent,
6356
UpdateContentAssetLinksInterface $updateContentAssetLinks,
64-
MetadataPool $metadataPool,
6557
array $fields
6658
) {
67-
$this->metadataPool = $metadataPool;
6859
$this->contentIdentityFactory = $contentIdentityFactory;
6960
$this->getContent = $getContent;
7061
$this->updateContentAssetLinks = $updateContentAssetLinks;
@@ -82,7 +73,6 @@ public function execute(Observer $observer): void
8273
$model = $observer->getEvent()->getData('product');
8374

8475
if ($model instanceof CatalogProduct) {
85-
$id = (int) $model->getData($this->metadataPool->getMetadata(ProductInterface::class)->getLinkField());
8676
foreach ($this->fields as $field) {
8777
if (!$model->dataHasChangedFor($field)) {
8878
continue;
@@ -95,7 +85,7 @@ public function execute(Observer $observer): void
9585
self::ENTITY_ID => (string) $model->getId(),
9686
]
9787
),
98-
$this->getContent->execute($id, $model->getAttributes()[$field])
88+
$this->getContent->execute((int) $model->getId(), $model->getAttributes()[$field])
9989
);
10090
}
10191
}

0 commit comments

Comments
 (0)