| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | public function findByUser(array $params): PaginationInterface |
||
| 14 | { |
||
| 15 | $qb = $this->createQueryBuilder('p') |
||
| 16 | ->where('p.author = :id'); |
||
| 17 | |||
| 18 | if ('published' === $params['state']) { |
||
| 19 | $qb->andWhere("p.state = 'published'"); |
||
| 20 | } else { |
||
| 21 | $qb->andWhere("p.state != 'published'"); |
||
| 22 | } |
||
| 23 | |||
| 24 | $qb->orderBy('p.id', 'DESC') |
||
| 25 | ->setParameter('id', $params['user']); |
||
| 26 | |||
| 27 | return $this->createPaginator($qb->getQuery(), $params['page']); |
||
| 28 | } |
||
| 44 |