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