Completed
Push — master ( 1e7ae1...1641c1 )
by Axel
04:29
created

NotificationRepository::read()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 1
dl 0
loc 13
ccs 0
cts 10
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Repository\User;
4
5
use Doctrine\ORM\EntityRepository;
6
7
class NotificationRepository extends EntityRepository
8
{
9
    public function read(array $ids = [])
10
    {
11
        return $this
12
            ->createQueryBuilder('n')
13
            ->update()
14
            ->set('n.readAt', ':read_at')
15
            ->where('n.id IN (:ids)')
16
            ->setParameters([
17
                'ids' => $ids,
18
                'read_at' => new \DateTime()
19
            ])
20
            ->getQuery()
21
            ->execute()
22
        ;
23
    }
24
}