Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit cf3f728

Browse files
authored
Merge pull request #2460 from magento-devdocs/imported-magento-devdocs-9078
Imported magento devdocs 9078
2 parents bf1f6fa + 8d65849 commit cf3f728

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/guides/v2.3/extension-dev-guide/extension_attributes/adding-attributes.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ Function `afterGetList` is similar to `afterGet`:
8080
```php
8181
public function afterGetList(
8282
\Magento\Catalog\Api\ProductRepositoryInterface $subject,
83-
\Magento\Catalog\Api\Data\ProductSearchResultsInterface $searchCriteria
83+
\Magento\Catalog\Api\Data\ProductSearchResultsInterface $searchResults
8484
) : \Magento\Catalog\Api\Data\ProductSearchResultsInterface
8585
{
8686
$products = [];
87-
foreach ($searchCriteria->getItems() as $entity) {
87+
foreach ($searchResults->getItems() as $entity) {
8888
$ourCustomData = $this->customDataRepository->get($entity->getId());
8989

9090
$extensionAttributes = $entity->getExtensionAttributes();
@@ -93,12 +93,12 @@ public function afterGetList(
9393

9494
$products[] = $entity;
9595
}
96-
$searchCriteria->setItems($products);
97-
return $searchCriteria;
96+
$searchResults->setItems($products);
97+
return $searchResults;
9898
}
9999
```
100100

101-
{:.bs-callout-info}
101+
{:.bs-callout-info}
102102
To add extension attributes to an entity without plugins, use the `extensionActions` argument of `\Magento\Framework\EntityManager\Operation\ExtensionPool`. See [\Magento\Catalog\Model\ProductRepository::getList()]({{ site.mage2bloburl }}/{{ page.guide_version }}/app/code/Magento/Catalog/Model/ProductRepository.php) as an example of an implementation.
103103

104104
Likewise, the `afterSave` plugin should manipulate the entity data before returning it:

0 commit comments

Comments
 (0)