7
7
namespace Magento \Customer \Model \ResourceModel ;
8
8
9
9
use Magento \Customer \Api \CustomerMetadataInterface ;
10
- use Magento \Customer \Model \Delegation \Data \NewOperation ;
10
+ use Magento \Customer \Api \Data \CustomerSearchResultsInterfaceFactory ;
11
+ use Magento \Framework \Api \ExtensibleDataObjectConverter ;
12
+ use Magento \Framework \Api \ExtensionAttribute \JoinProcessorInterface ;
13
+ use Magento \Customer \Model \CustomerFactory ;
14
+ use Magento \Customer \Model \CustomerRegistry ;
15
+ use Magento \Customer \Model \Data \CustomerSecureFactory ;
11
16
use Magento \Customer \Model \Customer \NotificationStorage ;
17
+ use Magento \Customer \Model \Delegation \Data \NewOperation ;
18
+ use Magento \Customer \Api \CustomerRepositoryInterface ;
12
19
use Magento \Framework \Api \DataObjectHelper ;
13
20
use Magento \Framework \Api \ImageProcessorInterface ;
14
21
use Magento \Framework \Api \SearchCriteria \CollectionProcessorInterface ;
15
22
use Magento \Framework \Api \SearchCriteriaInterface ;
23
+ use Magento \Framework \Api \Search \FilterGroup ;
24
+ use Magento \Framework \Event \ManagerInterface ;
16
25
use Magento \Customer \Model \Delegation \Storage as DelegatedStorage ;
17
26
use Magento \Framework \App \ObjectManager ;
27
+ use Magento \Store \Model \StoreManagerInterface ;
18
28
19
29
/**
20
30
* Customer repository.
31
+ *
21
32
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
22
33
* @SuppressWarnings(PHPMD.TooManyFields)
23
34
*/
24
- class CustomerRepository implements \ Magento \ Customer \ Api \ CustomerRepositoryInterface
35
+ class CustomerRepository implements CustomerRepositoryInterface
25
36
{
26
37
/**
27
- * @var \Magento\Customer\Model\ CustomerFactory
38
+ * @var CustomerFactory
28
39
*/
29
40
protected $ customerFactory ;
30
41
31
42
/**
32
- * @var \Magento\Customer\Model\Data\ CustomerSecureFactory
43
+ * @var CustomerSecureFactory
33
44
*/
34
45
protected $ customerSecureFactory ;
35
46
36
47
/**
37
- * @var \Magento\Customer\Model\ CustomerRegistry
48
+ * @var CustomerRegistry
38
49
*/
39
50
protected $ customerRegistry ;
40
51
41
52
/**
42
- * @var \Magento\Customer\Model\ResourceModel\ AddressRepository
53
+ * @var AddressRepository
43
54
*/
44
55
protected $ addressRepository ;
45
56
46
57
/**
47
- * @var \Magento\Customer\Model\ResourceModel\ Customer
58
+ * @var Customer
48
59
*/
49
60
protected $ customerResourceModel ;
50
61
51
62
/**
52
- * @var \Magento\Customer\Api\ CustomerMetadataInterface
63
+ * @var CustomerMetadataInterface
53
64
*/
54
65
protected $ customerMetadata ;
55
66
56
67
/**
57
- * @var \Magento\Customer\Api\Data\ CustomerSearchResultsInterfaceFactory
68
+ * @var CustomerSearchResultsInterfaceFactory
58
69
*/
59
70
protected $ searchResultsFactory ;
60
71
61
72
/**
62
- * @var \Magento\Framework\Event\ ManagerInterface
73
+ * @var ManagerInterface
63
74
*/
64
75
protected $ eventManager ;
65
76
66
77
/**
67
- * @var \Magento\Store\Model\ StoreManagerInterface
78
+ * @var StoreManagerInterface
68
79
*/
69
80
protected $ storeManager ;
70
81
71
82
/**
72
- * @var \Magento\Framework\Api\ ExtensibleDataObjectConverter
83
+ * @var ExtensibleDataObjectConverter
73
84
*/
74
85
protected $ extensibleDataObjectConverter ;
75
86
@@ -84,7 +95,7 @@ class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInte
84
95
protected $ imageProcessor ;
85
96
86
97
/**
87
- * @var \Magento\Framework\Api\ExtensionAttribute\ JoinProcessorInterface
98
+ * @var JoinProcessorInterface
88
99
*/
89
100
protected $ extensionAttributesJoinProcessor ;
90
101
@@ -104,38 +115,38 @@ class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInte
104
115
private $ delegatedStorage ;
105
116
106
117
/**
107
- * @param \Magento\Customer\Model\ CustomerFactory $customerFactory
108
- * @param \Magento\Customer\Model\Data\ CustomerSecureFactory $customerSecureFactory
109
- * @param \Magento\Customer\Model\ CustomerRegistry $customerRegistry
110
- * @param \Magento\Customer\Model\ResourceModel\ AddressRepository $addressRepository
111
- * @param \Magento\Customer\Model\ResourceModel\ Customer $customerResourceModel
112
- * @param \Magento\Customer\Api\ CustomerMetadataInterface $customerMetadata
113
- * @param \Magento\Customer\Api\Data\ CustomerSearchResultsInterfaceFactory $searchResultsFactory
114
- * @param \Magento\Framework\Event\ ManagerInterface $eventManager
115
- * @param \Magento\Store\Model\ StoreManagerInterface $storeManager
116
- * @param \Magento\Framework\Api\ ExtensibleDataObjectConverter $extensibleDataObjectConverter
118
+ * @param CustomerFactory $customerFactory
119
+ * @param CustomerSecureFactory $customerSecureFactory
120
+ * @param CustomerRegistry $customerRegistry
121
+ * @param AddressRepository $addressRepository
122
+ * @param Customer $customerResourceModel
123
+ * @param CustomerMetadataInterface $customerMetadata
124
+ * @param CustomerSearchResultsInterfaceFactory $searchResultsFactory
125
+ * @param ManagerInterface $eventManager
126
+ * @param StoreManagerInterface $storeManager
127
+ * @param ExtensibleDataObjectConverter $extensibleDataObjectConverter
117
128
* @param DataObjectHelper $dataObjectHelper
118
129
* @param ImageProcessorInterface $imageProcessor
119
- * @param \Magento\Framework\Api\ExtensionAttribute\ JoinProcessorInterface $extensionAttributesJoinProcessor
130
+ * @param JoinProcessorInterface $extensionAttributesJoinProcessor
120
131
* @param CollectionProcessorInterface $collectionProcessor
121
132
* @param NotificationStorage $notificationStorage
122
133
* @param DelegatedStorage|null $delegatedStorage
123
134
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
124
135
*/
125
136
public function __construct (
126
- \ Magento \ Customer \ Model \ CustomerFactory $ customerFactory ,
127
- \ Magento \ Customer \ Model \ Data \ CustomerSecureFactory $ customerSecureFactory ,
128
- \ Magento \ Customer \ Model \ CustomerRegistry $ customerRegistry ,
129
- \ Magento \ Customer \ Model \ ResourceModel \ AddressRepository $ addressRepository ,
130
- \ Magento \ Customer \ Model \ ResourceModel \ Customer $ customerResourceModel ,
131
- \ Magento \ Customer \ Api \ CustomerMetadataInterface $ customerMetadata ,
132
- \ Magento \ Customer \ Api \ Data \ CustomerSearchResultsInterfaceFactory $ searchResultsFactory ,
133
- \ Magento \ Framework \ Event \ ManagerInterface $ eventManager ,
134
- \ Magento \ Store \ Model \ StoreManagerInterface $ storeManager ,
135
- \ Magento \ Framework \ Api \ ExtensibleDataObjectConverter $ extensibleDataObjectConverter ,
137
+ CustomerFactory $ customerFactory ,
138
+ CustomerSecureFactory $ customerSecureFactory ,
139
+ CustomerRegistry $ customerRegistry ,
140
+ AddressRepository $ addressRepository ,
141
+ Customer $ customerResourceModel ,
142
+ CustomerMetadataInterface $ customerMetadata ,
143
+ CustomerSearchResultsInterfaceFactory $ searchResultsFactory ,
144
+ ManagerInterface $ eventManager ,
145
+ StoreManagerInterface $ storeManager ,
146
+ ExtensibleDataObjectConverter $ extensibleDataObjectConverter ,
136
147
DataObjectHelper $ dataObjectHelper ,
137
148
ImageProcessorInterface $ imageProcessor ,
138
- \ Magento \ Framework \ Api \ ExtensionAttribute \ JoinProcessorInterface $ extensionAttributesJoinProcessor ,
149
+ JoinProcessorInterface $ extensionAttributesJoinProcessor ,
139
150
CollectionProcessorInterface $ collectionProcessor ,
140
151
NotificationStorage $ notificationStorage ,
141
152
DelegatedStorage $ delegatedStorage = null
@@ -155,8 +166,7 @@ public function __construct(
155
166
$ this ->extensionAttributesJoinProcessor = $ extensionAttributesJoinProcessor ;
156
167
$ this ->collectionProcessor = $ collectionProcessor ;
157
168
$ this ->notificationStorage = $ notificationStorage ;
158
- $ this ->delegatedStorage = $ delegatedStorage
159
- ?? ObjectManager::getInstance ()->get (DelegatedStorage::class);
169
+ $ this ->delegatedStorage = $ delegatedStorage ?? ObjectManager::getInstance ()->get (DelegatedStorage::class);
160
170
}
161
171
162
172
/**
@@ -214,15 +224,15 @@ public function save(\Magento\Customer\Api\Data\CustomerInterface $customer, $pa
214
224
$ customerModel ->setRpToken (null );
215
225
$ customerModel ->setRpTokenCreatedAt (null );
216
226
}
217
- if (!array_key_exists ('default_billing ' , $ customerArr )
227
+ if (!array_key_exists ('addresses ' , $ customerArr )
218
228
&& null !== $ prevCustomerDataArr
219
229
&& array_key_exists ('default_billing ' , $ prevCustomerDataArr )
220
230
) {
221
231
$ customerModel ->setDefaultBilling (
222
232
$ prevCustomerDataArr ['default_billing ' ]
223
233
);
224
234
}
225
- if (!array_key_exists ('default_shipping ' , $ customerArr )
235
+ if (!array_key_exists ('addresses ' , $ customerArr )
226
236
&& null !== $ prevCustomerDataArr
227
237
&& array_key_exists ('default_shipping ' , $ prevCustomerDataArr )
228
238
) {
@@ -395,15 +405,12 @@ public function deleteById($customerId)
395
405
* Helper function that adds a FilterGroup to the collection.
396
406
*
397
407
* @deprecated 100.2.0
398
- * @param \Magento\Framework\Api\Search\ FilterGroup $filterGroup
399
- * @param \Magento\Customer\Model\ResourceModel\Customer\ Collection $collection
408
+ * @param FilterGroup $filterGroup
409
+ * @param Collection $collection
400
410
* @return void
401
- * @throws \Magento\Framework\Exception\InputException
402
411
*/
403
- protected function addFilterGroupToCollection (
404
- \Magento \Framework \Api \Search \FilterGroup $ filterGroup ,
405
- \Magento \Customer \Model \ResourceModel \Customer \Collection $ collection
406
- ) {
412
+ protected function addFilterGroupToCollection (FilterGroup $ filterGroup , Collection $ collection )
413
+ {
407
414
$ fields = [];
408
415
foreach ($ filterGroup ->getFilters () as $ filter ) {
409
416
$ condition = $ filter ->getConditionType () ? $ filter ->getConditionType () : 'eq ' ;
0 commit comments