MediaRepository   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A findExpiredMedias() 0 13 1
1
<?php
2
3
namespace Alpixel\Bundle\MediaBundle\Repository;
4
5
use Alpixel\Bundle\MediaBundle\Entity\Media;
6
use Doctrine\ORM\EntityRepository;
7
use Doctrine\ORM\QueryBuilder;
8
9
class MediaRepository extends EntityRepository
10
{
11
    public function findExpiredMedias()
12
    {
13
        $qb = new QueryBuilder($this->getEntityManager());
14
15
        return $qb
16
        ->select('m')
17
        ->from('AlpixelMediaBundle:Media', 'm')
18
        ->where('m.lifetime is not null')
19
        ->andWhere('m.lifetime < :now')
20
        ->setParameter('now', new \DateTime())
21
        ->getQuery()
22
        ->getResult();
23
    }
24
}
25