8
8
9
9
use Magento \Customer \Api \CustomerMetadataInterface ;
10
10
use Magento \Customer \Api \Data \CustomerInterface ;
11
- use Magento \Customer \Model \Delegation \Data \NewOperation ;
11
+ use Magento \Customer \Api \Data \CustomerSearchResultsInterfaceFactory ;
12
+ use Magento \Framework \Api \ExtensibleDataObjectConverter ;
13
+ use Magento \Framework \Api \ExtensionAttribute \JoinProcessorInterface ;
14
+ use Magento \Customer \Model \CustomerFactory ;
15
+ use Magento \Customer \Model \CustomerRegistry ;
16
+ use Magento \Customer \Model \Data \CustomerSecureFactory ;
12
17
use Magento \Customer \Model \Customer \NotificationStorage ;
18
+ use Magento \Customer \Model \Delegation \Data \NewOperation ;
19
+ use Magento \Customer \Api \CustomerRepositoryInterface ;
13
20
use Magento \Framework \Api \DataObjectHelper ;
14
21
use Magento \Framework \Api \ImageProcessorInterface ;
15
22
use Magento \Framework \Api \SearchCriteria \CollectionProcessorInterface ;
16
23
use Magento \Framework \Api \SearchCriteriaInterface ;
24
+ use Magento \Framework \Api \Search \FilterGroup ;
25
+ use Magento \Framework \Event \ManagerInterface ;
17
26
use Magento \Customer \Model \Delegation \Storage as DelegatedStorage ;
18
27
use Magento \Framework \App \ObjectManager ;
28
+ use Magento \Store \Model \StoreManagerInterface ;
19
29
20
30
/**
21
31
* Customer repository.
32
+ *
22
33
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
23
34
* @SuppressWarnings(PHPMD.TooManyFields)
24
35
*/
25
- class CustomerRepository implements \ Magento \ Customer \ Api \ CustomerRepositoryInterface
36
+ class CustomerRepository implements CustomerRepositoryInterface
26
37
{
27
38
/**
28
- * @var \Magento\Customer\Model\ CustomerFactory
39
+ * @var CustomerFactory
29
40
*/
30
41
protected $ customerFactory ;
31
42
32
43
/**
33
- * @var \Magento\Customer\Model\Data\ CustomerSecureFactory
44
+ * @var CustomerSecureFactory
34
45
*/
35
46
protected $ customerSecureFactory ;
36
47
37
48
/**
38
- * @var \Magento\Customer\Model\ CustomerRegistry
49
+ * @var CustomerRegistry
39
50
*/
40
51
protected $ customerRegistry ;
41
52
42
53
/**
43
- * @var \Magento\Customer\Model\ResourceModel\ AddressRepository
54
+ * @var AddressRepository
44
55
*/
45
56
protected $ addressRepository ;
46
57
47
58
/**
48
- * @var \Magento\Customer\Model\ResourceModel\ Customer
59
+ * @var Customer
49
60
*/
50
61
protected $ customerResourceModel ;
51
62
52
63
/**
53
- * @var \Magento\Customer\Api\ CustomerMetadataInterface
64
+ * @var CustomerMetadataInterface
54
65
*/
55
66
protected $ customerMetadata ;
56
67
57
68
/**
58
- * @var \Magento\Customer\Api\Data\ CustomerSearchResultsInterfaceFactory
69
+ * @var CustomerSearchResultsInterfaceFactory
59
70
*/
60
71
protected $ searchResultsFactory ;
61
72
62
73
/**
63
- * @var \Magento\Framework\Event\ ManagerInterface
74
+ * @var ManagerInterface
64
75
*/
65
76
protected $ eventManager ;
66
77
67
78
/**
68
- * @var \Magento\Store\Model\ StoreManagerInterface
79
+ * @var StoreManagerInterface
69
80
*/
70
81
protected $ storeManager ;
71
82
72
83
/**
73
- * @var \Magento\Framework\Api\ ExtensibleDataObjectConverter
84
+ * @var ExtensibleDataObjectConverter
74
85
*/
75
86
protected $ extensibleDataObjectConverter ;
76
87
@@ -85,7 +96,7 @@ class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInte
85
96
protected $ imageProcessor ;
86
97
87
98
/**
88
- * @var \Magento\Framework\Api\ExtensionAttribute\ JoinProcessorInterface
99
+ * @var JoinProcessorInterface
89
100
*/
90
101
protected $ extensionAttributesJoinProcessor ;
91
102
@@ -105,38 +116,38 @@ class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInte
105
116
private $ delegatedStorage ;
106
117
107
118
/**
108
- * @param \Magento\Customer\Model\ CustomerFactory $customerFactory
109
- * @param \Magento\Customer\Model\Data\ CustomerSecureFactory $customerSecureFactory
110
- * @param \Magento\Customer\Model\ CustomerRegistry $customerRegistry
111
- * @param \Magento\Customer\Model\ResourceModel\ AddressRepository $addressRepository
112
- * @param \Magento\Customer\Model\ResourceModel\ Customer $customerResourceModel
113
- * @param \Magento\Customer\Api\ CustomerMetadataInterface $customerMetadata
114
- * @param \Magento\Customer\Api\Data\ CustomerSearchResultsInterfaceFactory $searchResultsFactory
115
- * @param \Magento\Framework\Event\ ManagerInterface $eventManager
116
- * @param \Magento\Store\Model\ StoreManagerInterface $storeManager
117
- * @param \Magento\Framework\Api\ ExtensibleDataObjectConverter $extensibleDataObjectConverter
119
+ * @param CustomerFactory $customerFactory
120
+ * @param CustomerSecureFactory $customerSecureFactory
121
+ * @param CustomerRegistry $customerRegistry
122
+ * @param AddressRepository $addressRepository
123
+ * @param Customer $customerResourceModel
124
+ * @param CustomerMetadataInterface $customerMetadata
125
+ * @param CustomerSearchResultsInterfaceFactory $searchResultsFactory
126
+ * @param ManagerInterface $eventManager
127
+ * @param StoreManagerInterface $storeManager
128
+ * @param ExtensibleDataObjectConverter $extensibleDataObjectConverter
118
129
* @param DataObjectHelper $dataObjectHelper
119
130
* @param ImageProcessorInterface $imageProcessor
120
- * @param \Magento\Framework\Api\ExtensionAttribute\ JoinProcessorInterface $extensionAttributesJoinProcessor
131
+ * @param JoinProcessorInterface $extensionAttributesJoinProcessor
121
132
* @param CollectionProcessorInterface $collectionProcessor
122
133
* @param NotificationStorage $notificationStorage
123
134
* @param DelegatedStorage|null $delegatedStorage
124
135
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
125
136
*/
126
137
public function __construct (
127
- \ Magento \ Customer \ Model \ CustomerFactory $ customerFactory ,
128
- \ Magento \ Customer \ Model \ Data \ CustomerSecureFactory $ customerSecureFactory ,
129
- \ Magento \ Customer \ Model \ CustomerRegistry $ customerRegistry ,
130
- \ Magento \ Customer \ Model \ ResourceModel \ AddressRepository $ addressRepository ,
131
- \ Magento \ Customer \ Model \ ResourceModel \ Customer $ customerResourceModel ,
132
- \ Magento \ Customer \ Api \ CustomerMetadataInterface $ customerMetadata ,
133
- \ Magento \ Customer \ Api \ Data \ CustomerSearchResultsInterfaceFactory $ searchResultsFactory ,
134
- \ Magento \ Framework \ Event \ ManagerInterface $ eventManager ,
135
- \ Magento \ Store \ Model \ StoreManagerInterface $ storeManager ,
136
- \ Magento \ Framework \ Api \ ExtensibleDataObjectConverter $ extensibleDataObjectConverter ,
138
+ CustomerFactory $ customerFactory ,
139
+ CustomerSecureFactory $ customerSecureFactory ,
140
+ CustomerRegistry $ customerRegistry ,
141
+ AddressRepository $ addressRepository ,
142
+ Customer $ customerResourceModel ,
143
+ CustomerMetadataInterface $ customerMetadata ,
144
+ CustomerSearchResultsInterfaceFactory $ searchResultsFactory ,
145
+ ManagerInterface $ eventManager ,
146
+ StoreManagerInterface $ storeManager ,
147
+ ExtensibleDataObjectConverter $ extensibleDataObjectConverter ,
137
148
DataObjectHelper $ dataObjectHelper ,
138
149
ImageProcessorInterface $ imageProcessor ,
139
- \ Magento \ Framework \ Api \ ExtensionAttribute \ JoinProcessorInterface $ extensionAttributesJoinProcessor ,
150
+ JoinProcessorInterface $ extensionAttributesJoinProcessor ,
140
151
CollectionProcessorInterface $ collectionProcessor ,
141
152
NotificationStorage $ notificationStorage ,
142
153
DelegatedStorage $ delegatedStorage = null
@@ -156,8 +167,7 @@ public function __construct(
156
167
$ this ->extensionAttributesJoinProcessor = $ extensionAttributesJoinProcessor ;
157
168
$ this ->collectionProcessor = $ collectionProcessor ;
158
169
$ this ->notificationStorage = $ notificationStorage ;
159
- $ this ->delegatedStorage = $ delegatedStorage
160
- ?? ObjectManager::getInstance ()->get (DelegatedStorage::class);
170
+ $ this ->delegatedStorage = $ delegatedStorage ?? ObjectManager::getInstance ()->get (DelegatedStorage::class);
161
171
}
162
172
163
173
/**
@@ -200,13 +210,13 @@ public function save(CustomerInterface $customer, $passwordHash = null)
200
210
$ customerModel ->setRpToken (null );
201
211
$ customerModel ->setRpTokenCreatedAt (null );
202
212
}
203
- if (!array_key_exists ('default_billing ' , $ customerArr )
213
+ if (!array_key_exists ('addresses ' , $ customerArr )
204
214
&& null !== $ prevCustomerDataArr
205
215
&& array_key_exists ('default_billing ' , $ prevCustomerDataArr )
206
216
) {
207
217
$ customerModel ->setDefaultBilling ($ prevCustomerDataArr ['default_billing ' ]);
208
218
}
209
- if (!array_key_exists ('default_shipping ' , $ customerArr )
219
+ if (!array_key_exists ('addresses ' , $ customerArr )
210
220
&& null !== $ prevCustomerDataArr
211
221
&& array_key_exists ('default_shipping ' , $ prevCustomerDataArr )
212
222
) {
@@ -371,15 +381,12 @@ public function deleteById($customerId)
371
381
* Helper function that adds a FilterGroup to the collection.
372
382
*
373
383
* @deprecated 100.2.0
374
- * @param \Magento\Framework\Api\Search\ FilterGroup $filterGroup
375
- * @param \Magento\Customer\Model\ResourceModel\Customer\ Collection $collection
384
+ * @param FilterGroup $filterGroup
385
+ * @param Collection $collection
376
386
* @return void
377
- * @throws \Magento\Framework\Exception\InputException
378
387
*/
379
- protected function addFilterGroupToCollection (
380
- \Magento \Framework \Api \Search \FilterGroup $ filterGroup ,
381
- \Magento \Customer \Model \ResourceModel \Customer \Collection $ collection
382
- ) {
388
+ protected function addFilterGroupToCollection (FilterGroup $ filterGroup , Collection $ collection )
389
+ {
383
390
$ fields = [];
384
391
foreach ($ filterGroup ->getFilters () as $ filter ) {
385
392
$ condition = $ filter ->getConditionType () ? $ filter ->getConditionType () : 'eq ' ;
0 commit comments