Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
14.29% covered (danger)
14.29%
1 / 7
33.33% covered (danger)
33.33%
1 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
PersonRepository
14.29% covered (danger)
14.29%
1 / 7
33.33% covered (danger)
33.33%
1 / 3
20.74
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 add
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
 remove
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace App\Repository;
4
5use App\Entity\Person;
6use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
7use Doctrine\Persistence\ManagerRegistry;
8
9/**
10 * @extends ServiceEntityRepository<Person>
11 *
12 * @method Person|null find($id, $lockMode = null, $lockVersion = null)
13 * @method Person|null findOneBy(array $criteria, array $orderBy = null)
14 * @method Person[]    findAll()
15 * @method Person[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
16 */
17class PersonRepository extends ServiceEntityRepository
18{
19    public function __construct(ManagerRegistry $registry)
20    {
21        parent::__construct($registry, Person::class);
22    }
23
24    public function add(Person $entity, bool $flush = false): void
25    {
26        $this->getEntityManager()->persist($entity);
27
28        if ($flush) {
29            $this->getEntityManager()->flush();
30        }
31    }
32
33    public function remove(Person $entity, bool $flush = false): void
34    {
35        $this->getEntityManager()->remove($entity);
36
37        if ($flush) {
38            $this->getEntityManager()->flush();
39        }
40    }
41
42//    /**
43//     * @return Person[] Returns an array of Person objects
44//     */
45//    public function findByExampleField($value): array
46//    {
47//        return $this->createQueryBuilder('p')
48//            ->andWhere('p.exampleField = :val')
49//            ->setParameter('val', $value)
50//            ->orderBy('p.id', 'ASC')
51//            ->setMaxResults(10)
52//            ->getQuery()
53//            ->getResult()
54//        ;
55//    }
56
57//    public function findOneBySomeField($value): ?Person
58//    {
59//        return $this->createQueryBuilder('p')
60//            ->andWhere('p.exampleField = :val')
61//            ->setParameter('val', $value)
62//            ->getQuery()
63//            ->getOneOrNullResult()
64//        ;
65//    }
66}