Conditions | 4 |
Paths | 2 |
Total Lines | 26 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 3 | ||
Bugs | 3 | Features | 0 |
1 | <?php |
||
23 | public function search($searchParams = array()) |
||
24 | { |
||
25 | $queryBuilder = $this->createQueryBuilder('e'); |
||
26 | |||
27 | if (!empty($searchParams)) { |
||
28 | $searchAttributes = array( |
||
29 | 'recipients', |
||
30 | 'template', |
||
31 | 'sent', |
||
32 | 'variables', |
||
33 | 'token', |
||
34 | ); |
||
35 | |||
36 | foreach ($searchAttributes as $attribute) { |
||
37 | if (empty($searchParams[$attribute])) { |
||
38 | continue; |
||
39 | } |
||
40 | |||
41 | $attributeValue = $searchParams[$attribute]; |
||
42 | |||
43 | $queryBuilder->andWhere('e.'.$attribute.' LIKE :'.$attribute) |
||
44 | ->setParameter($attribute, '%'.$attributeValue.'%'); |
||
45 | } |
||
46 | } |
||
47 | |||
48 | return $queryBuilder->getQuery(); |
||
49 | } |
||
51 |