This repository was archived by the owner on Apr 29, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-1
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 +16
-1
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,21 @@ protected function _joinCustomers()
103
103
return $ this ;
104
104
}
105
105
106
+ /**
107
+ * {@inheritdoc}
108
+ *
109
+ * Additional processing of 'customer_name' field is required, as it is a concat field, which can not be aliased.
110
+ * @see _joinCustomers
111
+ */
112
+ public function addFieldToFilter ($ field , $ condition = null )
113
+ {
114
+ if ($ field === 'customer_name ' ) {
115
+ $ field = $ this ->getConnection ()->getConcatSql (['customer.firstname ' , 'customer.lastname ' ], ' ' );
116
+ }
117
+
118
+ return parent ::addFieldToFilter ($ field , $ condition );
119
+ }
120
+
106
121
/**
107
122
* Get select count sql
108
123
*
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