Conditions | 3 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3.072 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | 2 | public function findPostHeaders(?\DateTime $from = null): array |
|
17 | { |
||
18 | 2 | $headerClass = CommentPostHeader::class; |
|
19 | 2 | $dtoClass = CommentsPostHeaderDto::class; |
|
20 | 2 | $dql = "select new $dtoClass(p.id, p.title, p.summary, p.tags, p.createdById, p.createdByName, p.createdAt, p.version) from $headerClass p"; |
|
21 | 2 | if ($from != null) { |
|
22 | $dql = $dql . " where p.createdAt >= :from"; |
||
23 | } |
||
24 | 2 | $query = $this->getEntityManager()->createQuery($dql); |
|
25 | 2 | if ($from != null) { |
|
26 | $query = $query->setParameter("from", $from); |
||
27 | } |
||
28 | 2 | return $query->getArrayResult(); |
|
29 | } |
||
45 | } |