Skip to content

Commit 375132a

Browse files
author
Alex Paliarush
committed
MAGETWO-90358: Auto-generate ExtensionAttributes object
1 parent 9dfd2b2 commit 375132a

32 files changed

+268
-121
lines changed

app/code/Magento/Catalog/Model/Product.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,13 +2533,7 @@ public function setTypeId($typeId)
25332533
*/
25342534
public function getExtensionAttributes()
25352535
{
2536-
$extensionAttributes = $this->_getExtensionAttributes();
2537-
if (null === $extensionAttributes) {
2538-
/** @var \Magento\Catalog\Api\Data\ProductExtensionInterface $extensionAttributes */
2539-
$extensionAttributes = $this->extensionAttributesFactory->create(ProductInterface::class);
2540-
$this->setExtensionAttributes($extensionAttributes);
2541-
}
2542-
return $extensionAttributes;
2536+
return $this->_getExtensionAttributes();
25432537
}
25442538

25452539
/**

app/code/Magento/Checkout/Api/Data/PaymentDetailsInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Interface PaymentDetailsInterface
1010
* @api
1111
*/
12-
interface PaymentDetailsInterface
12+
interface PaymentDetailsInterface extends \Magento\Framework\Api\ExtensibleDataInterface
1313
{
1414
/**#@+
1515
* Constants defined for keys of array, makes typos less likely
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
* Copyright © Magento, Inc. All rights reserved.
55
* See COPYING.txt for license details.
66
*/
7+
declare(strict_types=1);
78

8-
namespace Magento\Wonderland\Api\Data;
9+
namespace Magento\TestModuleExtensionAttributes\Api\Data;
910

1011
use Magento\Framework\Api\ExtensibleDataInterface;
1112

@@ -55,14 +56,14 @@ public function getCustomerId();
5556
/**
5657
* Get region
5758
*
58-
* @return \Magento\Wonderland\Api\Data\FakeRegionInterface|null
59+
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionInterface|null
5960
*/
6061
public function getRegion();
6162

6263
/**
6364
* Get region
6465
*
65-
* @return \Magento\Wonderland\Api\Data\FakeRegionInterface[]|null
66+
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionInterface[]|null
6667
*/
6768
public function getRegions();
6869

@@ -174,17 +175,17 @@ public function isDefaultBilling();
174175
/**
175176
* Retrieve existing extension attributes object or create a new one.
176177
*
177-
* @return \Magento\Wonderland\Api\Data\FakeAddressExtensionInterface|null
178+
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressExtensionInterface|null
178179
*/
179180
public function getExtensionAttributes();
180181

181182
/**
182183
* Set an extension attributes object.
183184
*
184-
* @param \Magento\Wonderland\Api\Data\FakeAddressExtensionInterface $extensionAttributes
185+
* @param \Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressExtensionInterface $extensionAttributes
185186
* @return $this
186187
*/
187188
public function setExtensionAttributes(
188-
\Magento\Wonderland\Api\Data\FakeAddressExtensionInterface $extensionAttributes
189+
\Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressExtensionInterface $extensionAttributes
189190
);
190191
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

7-
namespace Magento\Wonderland\Api\Data;
8+
namespace Magento\TestModuleExtensionAttributes\Api\Data;
89

910
/**
1011
* Customer attribute metadata interface.
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
namespace Magento\Wonderland\Api\Data;
6+
declare(strict_types=1);
7+
8+
namespace Magento\TestModuleExtensionAttributes\Api\Data;
79

810
/**
911
* Customer interface.
@@ -98,17 +100,17 @@ public function setPrefix($prefix);
98100
/**
99101
* Retrieve existing extension attributes object or create a new one.
100102
*
101-
* @return \Magento\Wonderland\Api\Data\FakeCustomerExtensionInterface|null
103+
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeCustomerExtensionInterface|null
102104
*/
103105
public function getExtensionAttributes();
104106

105107
/**
106108
* Set an extension attributes object.
107109
*
108-
* @param \Magento\Wonderland\Api\Data\FakeCustomerExtensionInterface $extensionAttributes
110+
* @param \Magento\TestModuleExtensionAttributes\Api\Data\FakeCustomerExtensionInterface $extensionAttributes
109111
* @return $this
110112
*/
111113
public function setExtensionAttributes(
112-
\Magento\Wonderland\Api\Data\FakeCustomerExtensionInterface $extensionAttributes
114+
\Magento\TestModuleExtensionAttributes\Api\Data\FakeCustomerExtensionInterface $extensionAttributes
113115
);
114116
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
* Copyright © Magento, Inc. All rights reserved.
55
* See COPYING.txt for license details.
66
*/
7+
declare(strict_types=1);
78

8-
namespace Magento\Wonderland\Api\Data;
9+
namespace Magento\TestModuleExtensionAttributes\Api\Data;
910

1011
use Magento\Framework\Api\ExtensibleDataInterface;
1112

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
* Copyright © Magento, Inc. All rights reserved.
55
* See COPYING.txt for license details.
66
*/
7+
declare(strict_types=1);
78

8-
namespace Magento\Wonderland\Api\Data;
9+
namespace Magento\TestModuleExtensionAttributes\Api\Data;
910

1011
use Magento\Framework\Api\ExtensibleDataInterface;
1112

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
* Copyright © Magento, Inc. All rights reserved.
55
* See COPYING.txt for license details.
66
*/
7-
namespace Magento\Wonderland\Api\Data;
7+
declare(strict_types=1);
8+
9+
namespace Magento\TestModuleExtensionAttributes\Api\Data;
810

911
use Magento\Framework\Api\ExtensibleDataInterface;
1012

@@ -45,17 +47,17 @@ public function getRegionId();
4547
/**
4648
* Retrieve existing extension attributes object or create a new one.
4749
*
48-
* @return \Magento\Wonderland\Api\Data\FakeRegionExtensionInterface|null
50+
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionExtensionInterface|null
4951
*/
5052
public function getExtensionAttributes();
5153

5254
/**
5355
* Set an extension attributes object.
5456
*
55-
* @param \Magento\Wonderland\Api\Data\FakeRegionExtensionInterface $extensionAttributes
57+
* @param \Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionExtensionInterface $extensionAttributes
5658
* @return $this
5759
*/
5860
public function setExtensionAttributes(
59-
\Magento\Wonderland\Api\Data\FakeRegionExtensionInterface $extensionAttributes
61+
\Magento\TestModuleExtensionAttributes\Api\Data\FakeRegionExtensionInterface $extensionAttributes
6062
);
6163
}
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
* Copyright © Magento, Inc. All rights reserved.
55
* See COPYING.txt for license details.
66
*/
7-
namespace Magento\Wonderland\Model\Data;
7+
declare(strict_types=1);
8+
9+
namespace Magento\TestModuleExtensionAttributes\Model\Data;
810

911
use Magento\Framework\Api\AbstractExtensibleObject;
10-
use Magento\Wonderland\Api\Data\FakeAddressInterface;
12+
use Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressInterface;
1113

1214
class FakeAddress extends AbstractExtensibleObject implements FakeAddressInterface
1315
{
@@ -34,7 +36,7 @@ public function getCustomerId()
3436
/**
3537
* Get region
3638
*
37-
* @return \Magento\Wonderland\Model\Data\FakeRegion|null
39+
* @return \Magento\TestModuleExtensionAttributes\Model\Data\FakeRegion|null
3840
*/
3941
public function getRegion()
4042
{
@@ -44,7 +46,7 @@ public function getRegion()
4446
/**
4547
* Get region
4648
*
47-
* @return \Magento\Wonderland\Model\Data\FakeRegion[]|null
49+
* @return \Magento\TestModuleExtensionAttributes\Model\Data\FakeRegion[]|null
4850
*/
4951
public function getRegions()
5052
{
@@ -194,7 +196,7 @@ public function isDefaultShipping()
194196
/**
195197
* {@inheritdoc}
196198
*
197-
* @return \Magento\Wonderland\Api\Data\FakeAddressExtensionInterface|null
199+
* @return \Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressExtensionInterface|null
198200
*/
199201
public function getExtensionAttributes()
200202
{
@@ -214,11 +216,11 @@ public function isDefaultBilling()
214216
/**
215217
* {@inheritdoc}
216218
*
217-
* @param \Magento\Wonderland\Api\Data\FakeAddressExtensionInterface $extensionAttributes
219+
* @param \Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressExtensionInterface $extensionAttributes
218220
* @return $this
219221
*/
220222
public function setExtensionAttributes(
221-
\Magento\Wonderland\Api\Data\FakeAddressExtensionInterface $extensionAttributes
223+
\Magento\TestModuleExtensionAttributes\Api\Data\FakeAddressExtensionInterface $extensionAttributes
222224
) {
223225
return $this->_setExtensionAttributes($extensionAttributes);
224226
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

7-
namespace Magento\Wonderland\Model\Data;
8+
namespace Magento\TestModuleExtensionAttributes\Model\Data;
89

910
/**
1011
* Customer attribute metadata class.
1112
*/
1213
class FakeAttributeMetadata extends \Magento\Framework\Api\AbstractSimpleObject implements
13-
\Magento\Wonderland\Api\Data\FakeAttributeMetadataInterface
14+
\Magento\TestModuleExtensionAttributes\Api\Data\FakeAttributeMetadataInterface
1415
{
1516
/**
1617
* {@inheritdoc}

0 commit comments

Comments
 (0)