MediaRepository::findExpiredMedias()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 0
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