File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
app/code/Magento/Reports/Model/ResourceModel/Review/Customer
dev/tests/integration/testsuite/Magento/Reports/Model/ResourceModel/Review/Customer Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ protected function _joinCustomers()
83
83
$ this ->getSelect ()->reset (
84
84
\Magento \Framework \DB \Select::COLUMNS
85
85
)->joinInner (
86
- ['customer ' => $ connection -> getTableName ('customer_entity ' )],
86
+ ['customer ' => $ this -> getTable ('customer_entity ' )],
87
87
'customer.entity_id = detail.customer_id ' ,
88
88
[]
89
89
)->columns (
@@ -99,6 +99,21 @@ protected function _joinCustomers()
99
99
return $ this ;
100
100
}
101
101
102
+ /**
103
+ * {@inheritdoc}
104
+ *
105
+ * Additional processing of 'customer_name' field is required, as it is a concat field, which can not be aliased.
106
+ * @see _joinCustomers
107
+ */
108
+ public function addFieldToFilter ($ field , $ condition = null )
109
+ {
110
+ if ($ field === 'customer_name ' ) {
111
+ $ field = $ this ->getConnection ()->getConcatSql (['customer.firstname ' , 'customer.lastname ' ], ' ' );
112
+ }
113
+
114
+ return parent ::addFieldToFilter ($ field , $ condition );
115
+ }
116
+
102
117
/**
103
118
* Get select count sql
104
119
*
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ protected function setUp()
30
30
*/
31
31
public function testSelectCountSql ()
32
32
{
33
- $ this ->collection ->addFieldToFilter ('customer_name ' , ['like ' => '%john % ' ]);
33
+ $ this ->collection ->addFieldToFilter ('customer_name ' , ['like ' => '%John % ' ])-> getItems ( );
34
34
$ this ->assertEquals (1 , $ this ->collection ->getSize ());
35
35
}
36
36
}
You can’t perform that action at this time.
0 commit comments