@@ -22,45 +22,26 @@ protected function checkAllDependenciesInjected()
22
22
23
23
/**
24
24
* @param string $searchTerm
25
- * @param int $firstResult
26
- * @param int $maxResults
25
+ * @param int $firstResult
26
+ * @param int $maxResults
27
27
* @return QueryBuilder
28
28
*/
29
29
protected function prepareQueryBuilder ($ searchTerm , $ firstResult , $ maxResults )
30
30
{
31
- $ queryBuilder = $ this ->entityRepository ->createQueryBuilder ( ' scg ' );
31
+ $ queryBuilder = $ this ->entityRepository ->getNonSystemSalesChannelBySearchTermQB ( $ searchTerm );
32
32
$ queryBuilder
33
- ->where ($ queryBuilder ->expr ()->like ('LOWER(scg.name) ' , ':searchTerm ' ))
34
- ->andWhere (($ queryBuilder ->expr ()->eq ('scg.system ' , $ queryBuilder ->expr ()->literal (false ))))
35
- ->setParameter ('searchTerm ' , '% ' . mb_strtolower ($ searchTerm ) . '% ' )
36
- ->orderBy ('scg.name ' , 'ASC ' )
37
33
->setFirstResult ($ firstResult )
38
34
->setMaxResults ($ maxResults );
39
35
40
36
return $ queryBuilder ;
41
37
}
42
38
43
39
/**
44
- * {@inheritdoc }
40
+ * {@inheritDoc }
45
41
*/
46
42
protected function searchEntities ($ search , $ firstResult , $ maxResults )
47
43
{
48
44
$ queryBuilder = $ this ->prepareQueryBuilder ($ search , $ firstResult , $ maxResults );
49
- $ query = $ this ->aclHelper ->apply ($ queryBuilder , 'VIEW ' );
50
-
51
- return $ query ->getResult ();
52
- }
53
-
54
- /**
55
- * {@inheritdoc}
56
- */
57
- protected function findById ($ query )
58
- {
59
- $ parts = explode ('; ' , $ query );
60
- $ id = $ parts [0 ];
61
-
62
- $ criteria = [$ this ->idFieldName => $ id ];
63
-
64
- return [$ this ->entityRepository ->findOneBy ($ criteria , null )];
45
+ return $ this ->aclHelper ->apply ($ queryBuilder ->getQuery ())->getResult ();
65
46
}
66
47
}
0 commit comments