| Conditions | 2 |
| Paths | 2 |
| Total Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function lastUserSubscribersByIdAction(User $user, SubscriptionEventRepository $subscriptionEventRepository): Response |
||
| 19 | { |
||
| 20 | $qb = $subscriptionEventRepository->createQueryBuilder('se'); |
||
| 21 | $qb |
||
| 22 | ->select(['se', 'sub']) |
||
| 23 | ->innerJoin('se.subscriber', 'sub') |
||
| 24 | ->where($qb->expr()->eq('se.author', ':author')) |
||
| 25 | ->orderBy('se.date', 'desc') |
||
| 26 | ->setParameter('author', $user) |
||
| 27 | ->setMaxResults(20) |
||
| 28 | ; |
||
| 29 | |||
| 30 | $data = []; |
||
| 31 | |||
| 32 | /** @var SubscriptionEvent $event */ |
||
| 33 | foreach ($qb->getQuery()->getResult() as $event) { |
||
| 34 | $data[] = [ |
||
| 35 | 'user' => $event->getSubscriber()->getLogin(), |
||
| 36 | 'action' => $event->getAction(), |
||
| 37 | 'datetime' => $event->getDate()->format('d.m.Y H:i:s'), |
||
| 38 | ]; |
||
| 39 | } |
||
| 40 | |||
| 41 | return new JsonResponse($data); |
||
| 42 | } |
||
| 43 | } |
||
| 44 |