File tree Expand file tree Collapse file tree 4 files changed +44
-1
lines changed
src/BitExpert_PHPStanTests Expand file tree Collapse file tree 4 files changed +44
-1
lines changed Original file line number Diff line number Diff line change 21
21
"cweagans/composer-patches" : " ^1.7" ,
22
22
"magento/composer-dependency-version-audit-plugin" : " ~0.1" ,
23
23
"magento/composer-root-update-plugin" : " ~2.0" ,
24
+ "magento/module-catalog" : " ^104.0" ,
25
+ "magento/module-inventory-api" : " ^1.2" ,
24
26
"magento/product-community-edition" : " 2.4.5" ,
25
27
"swissup/module-search-mysql-legacy" : " ^1.1" ,
26
28
"yireo/magento2-replace-all" : " ^4.2"
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace BitExpert \PHPStanTests \Helper ;
6
+
7
+ /**
8
+ * Test Extension attributes
9
+ */
10
+ class TestExtAttributes
11
+ {
12
+ public function __construct (
13
+ \Magento \Catalog \Api \Data \ProductExtension $ productExt ,
14
+ \Magento \InventoryApi \Api \Data \StockExtension $ stockExt
15
+ )
16
+ {
17
+ // access extension attributes defined in extension_attributes.xml in the module
18
+ $ productExt ->setAdditionalName ('Additional name ' );
19
+ $ name = $ productExt ->getAdditionalName ();
20
+ $ productExt ->setAdditionalId (99 );
21
+ $ id = $ productExt ->getAdditionalId ();
22
+
23
+ $ stockExt ->setSalesChannels (null );
24
+ $ channels = $ stockExt ->getSalesChannels ();
25
+
26
+ // access extension attribute defined in Magento_CatalogInventory
27
+ $ stockItem = $ productExt ->getStockItem ();
28
+ }
29
+ }
Original file line number Diff line number Diff line change 4
4
"license" : " Apache-2.0" ,
5
5
"require" : {
6
6
"php" : " ~8.1.0" ,
7
- "magento/framework" : " ~103.0.5"
7
+ "magento/framework" : " ~103.0.5" ,
8
+ "magento/module-inventory-api" : " ^1.2" ,
9
+ "magento/module-catalog" : " ^104.0"
8
10
},
9
11
"repositories" : [
10
12
{
Original file line number Diff line number Diff line change
1
+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:Api/etc/extension_attributes.xsd" >
2
+ <extension_attributes for =" Magento\Catalog\Api\Data\ProductInterface" >
3
+ <attribute code =" additional_name" type =" string" />
4
+ <attribute code =" additional_id" type =" int" />
5
+ </extension_attributes >
6
+
7
+ <extension_attributes for =" Magento\InventoryApi\Api\Data\StockInterface" >
8
+ <attribute code =" sales_channels" type =" Magento\InventorySalesApi\Api\Data\SalesChannelInterface[]" />
9
+ </extension_attributes >
10
+ </config >
You can’t perform that action at this time.
0 commit comments