Test Setup Failed
Pull Request — master (#15)
by Stone
03:13
created

TrickRepository::findLatestEdited()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Repository;
4
5
use App\Entity\Trick;
6
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
7
use Symfony\Bridge\Doctrine\RegistryInterface;
8
9
/**
10
 * @method Trick|null find($id, $lockMode = null, $lockVersion = null)
11
 * @method Trick|null findOneBy(array $criteria, array $orderBy = null)
12
 * @method Trick[]    findAll()
13
 * @method Trick[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
14
 */
15
class TrickRepository extends ServiceEntityRepository
16
{
17
    public function __construct(RegistryInterface $registry)
18
    {
19
        parent::__construct($registry, Trick::class);
20
    }
21
22
    /**
23
     * @return Trick[] Returns an array of Trick objects
24
     */
25
    public function findLatestEdited($limit = Trick::NUMBER_OF_DISPLAYED_TRICKS)
26
    {
27
        return $this->createQueryBuilder('t')
28
            ->orderBy('t.editedAt', 'DESC')
29
            ->setMaxResults($limit)
30
            ->getQuery()
31
            ->getResult()
32
            ;
33
    }
34
35
    // /**
36
    //  * @return Trick[] Returns an array of Trick objects
37
    //  */
38
    /*
39
    public function findByExampleField($value)
40
    {
41
        return $this->createQueryBuilder('t')
42
            ->andWhere('t.exampleField = :val')
43
            ->setParameter('val', $value)
44
            ->orderBy('t.id', 'ASC')
45
            ->setMaxResults(10)
46
            ->getQuery()
47
            ->getResult()
48
        ;
49
    }
50
    */
51
52
    /*
53
    public function findOneBySomeField($value): ?Trick
54
    {
55
        return $this->createQueryBuilder('t')
56
            ->andWhere('t.exampleField = :val')
57
            ->setParameter('val', $value)
58
            ->getQuery()
59
            ->getOneOrNullResult()
60
        ;
61
    }
62
    */
63
}
64