File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
app/code/Magento/CatalogInventory
Test/Unit/Model/Adminhtml/Stock Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 11
11
use Magento \Customer \Api \GroupManagementInterface ;
12
12
use Magento \Framework \Api \AttributeValueFactory ;
13
13
use Magento \Framework \Api \ExtensionAttributesFactory ;
14
+ use Magento \Framework \Object \IdentityInterface ;
14
15
15
16
/**
16
17
* Catalog Inventory Stock Model for adminhtml area
17
18
* @method \Magento\CatalogInventory\Api\Data\StockItemExtensionInterface getExtensionAttributes()
18
19
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
19
20
*/
20
- class Item extends \Magento \CatalogInventory \Model \Stock \Item
21
+ class Item extends \Magento \CatalogInventory \Model \Stock \Item implements IdentityInterface
21
22
{
22
23
/**
23
24
* @var GroupManagementInterface
@@ -122,4 +123,17 @@ public function getShowDefaultNotificationMessage()
122
123
{
123
124
return true ;
124
125
}
126
+
127
+ /**
128
+ * @inheritdoc
129
+ */
130
+ public function getIdentities ()
131
+ {
132
+ $ tags = [];
133
+ if ($ this ->getProductId ()) {
134
+ $ tags [] = 'catalog_product_ ' . $ this ->getProductId ();
135
+ }
136
+
137
+ return $ tags ;
138
+ }
125
139
}
Original file line number Diff line number Diff line change @@ -58,4 +58,10 @@ public function testGetCustomerGroupId()
58
58
$ this ->_model ->setCustomerGroupId (2 );
59
59
$ this ->assertEquals (2 , $ this ->_model ->getCustomerGroupId ());
60
60
}
61
+
62
+ public function testGetIdentities ()
63
+ {
64
+ $ this ->_model ->setProductId (1 );
65
+ $ this ->assertEquals (['catalog_product_1 ' ], $ this ->_model ->getIdentities ());
66
+ }
61
67
}
You can’t perform that action at this time.
0 commit comments