| Conditions | 5 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 34 | public function setRead(RequestEvent $event) |
||
| 35 | { |
||
| 36 | $topic = $event->getRequest()->attributes->get('data'); |
||
| 37 | $method = $event->getRequest()->getMethod(); |
||
| 38 | $user = $this->security->getUser(); |
||
| 39 | |||
| 40 | if ($user && ($topic instanceof Topic) && $method == Request::METHOD_GET) { |
||
| 41 | $userTopic = $this->em->getRepository('ProjetNormandie\ForumBundle\Entity\TopicUser')->findOneBy( |
||
| 42 | array( |
||
| 43 | 'user' => $user, |
||
| 44 | 'topic' => $topic, |
||
| 45 | ) |
||
| 46 | ); |
||
| 47 | if ($userTopic) { |
||
| 48 | $userTopic->setBoolRead(true); |
||
| 49 | $this->em->flush(); |
||
| 50 | } |
||
| 54 |