@@ -91,9 +91,6 @@ protected function _construct()
91
91
$ this ->_queueLinkTable = $ this ->getTable ('newsletter_queue_link ' );
92
92
$ this ->_storeTable = $ this ->getTable ('store ' );
93
93
94
- // defining mapping for fields represented in several tables
95
- $ this ->_map ['fields ' ]['customer_lastname ' ] = 'customer_lastname_table.value ' ;
96
- $ this ->_map ['fields ' ]['customer_firstname ' ] = 'customer_firstname_table.value ' ;
97
94
$ this ->_map ['fields ' ]['type ' ] = $ this ->getResource ()->getReadConnection ()->getCheckSql (
98
95
'main_table.customer_id = 0 ' ,
99
96
1 ,
@@ -145,37 +142,16 @@ public function useOnlyUnsent()
145
142
*/
146
143
public function showCustomerInfo ()
147
144
{
148
- $ adapter = $ this ->getConnection ();
149
-
150
- $ lastNameData = $ this ->_customerHelperData -> getAttributeMetadata (
151
- \ Magento \ Customer \ Api \CustomerMetadataInterface:: ENTITY_TYPE_CUSTOMER ,
152
- 'lastname '
153
- );
154
- $ firstNameData = $ this -> _customerHelperData -> getAttributeMetadata (
155
- \ Magento \ Customer \ Api \CustomerMetadataInterface:: ENTITY_TYPE_CUSTOMER ,
156
- ' firstname '
145
+ $ this ->getSelect ()-> joinLeft (
146
+ [
147
+ ' customer ' => $ this ->getTable ( ' customer_entity ' )
148
+ ] ,
149
+ 'main_table.customer_id ' ,
150
+ [
151
+ ' customer_lastname ' => ' lastname ' ,
152
+ ' customer_firstname ' => ' firstname '
153
+ ]
157
154
);
158
-
159
- $ this ->getSelect ()
160
- ->joinLeft (
161
- ['customer_lastname_table ' => $ lastNameData ['attribute_table ' ]],
162
- $ adapter ->quoteInto (
163
- 'customer_lastname_table.entity_id=main_table.customer_id
164
- AND customer_lastname_table.attribute_id = ? ' ,
165
- (int )$ lastNameData ['attribute_id ' ]
166
- ),
167
- ['customer_lastname ' => 'value ' ]
168
- )
169
- ->joinLeft (
170
- ['customer_firstname_table ' => $ firstNameData ['attribute_table ' ]],
171
- $ adapter ->quoteInto (
172
- 'customer_firstname_table.entity_id=main_table.customer_id
173
- AND customer_firstname_table.attribute_id = ? ' ,
174
- (int )$ firstNameData ['attribute_id ' ]
175
- ),
176
- ['customer_firstname ' => 'value ' ]
177
- );
178
-
179
155
return $ this ;
180
156
}
181
157
0 commit comments