12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Bundle\Model\Plugin;
- use Magento\Bundle\Model\Product\Type;
- use Magento\Catalog\Model\Product as CatalogProduct;
- class Product
- {
- /**
- * @var Type
- */
- private $type;
- /**
- * @param Type $type
- */
- public function __construct(Type $type)
- {
- $this->type = $type;
- }
- /**
- * @param CatalogProduct $product
- * @param array $identities
- * @return string[]
- */
- public function afterGetIdentities(
- CatalogProduct $product,
- array $identities
- ) {
- foreach ($this->type->getParentIdsByChild($product->getEntityId()) as $parentId) {
- $identities[] = CatalogProduct::CACHE_TAG . '_' . $parentId;
- }
- return $identities;
- }
- }
|