ProductGroupRepository::add()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace ControleOnline\Repository;
4
5
use ControleOnline\Entity\ProductGroup;
6
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
0 ignored issues
show
Bug introduced by
The type Doctrine\Bundle\Doctrine...ServiceEntityRepository was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Doctrine\ORM\OptimisticLockException;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\OptimisticLockException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Doctrine\ORM\ORMException;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\ORMException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Doctrine\Persistence\ManagerRegistry;
0 ignored issues
show
Bug introduced by
The type Doctrine\Persistence\ManagerRegistry was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
11
/**
12
 * @extends ServiceEntityRepository<ProductGroup>
13
 *
14
 * @method ProductGroup|null find($id, $lockMode = null, $lockVersion = null)
15
 * @method ProductGroup|null findOneBy(array $criteria, array $orderBy = null)
16
 * @method ProductGroup[]    findAll()
17
 * @method ProductGroup[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
18
 */
19
class ProductGroupRepository extends ServiceEntityRepository
20
{
21
    public function __construct(ManagerRegistry $registry)
22
    {
23
        parent::__construct($registry, ProductGroup::class);
24
    }
25
26
    /**
27
     * @throws ORMException
28
     * @throws OptimisticLockException
29
     */
30
    public function add(ProductGroup $entity, bool $flush = true): void
31
    {
32
        $this->_em->persist($entity);
33
        if ($flush) {
34
            $this->_em->flush();
35
        }
36
    }
37
38
    /**
39
     * @throws ORMException
40
     * @throws OptimisticLockException
41
     */
42
    public function remove(ProductGroup $entity, bool $flush = true): void
43
    {
44
        $this->_em->remove($entity);
45
        if ($flush) {
46
            $this->_em->flush();
47
        }
48
    }
49
50
    // /**
51
    //  * @return ProductGroup[] Returns an array of ProductGroup objects
52
    //  */
53
    /*
54
    public function findByExampleField($value)
55
    {
56
        return $this->createQueryBuilder('p')
57
            ->andWhere('p.exampleField = :val')
58
            ->setParameter('val', $value)
59
            ->orderBy('p.id', 'ASC')
60
            ->setMaxResults(10)
61
            ->getQuery()
62
            ->getResult()
63
        ;
64
    }
65
    */
66
67
    /*
68
    public function findOneBySomeField($value): ?ProductGroup
69
    {
70
        return $this->createQueryBuilder('p')
71
            ->andWhere('p.exampleField = :val')
72
            ->setParameter('val', $value)
73
            ->getQuery()
74
            ->getOneOrNullResult()
75
        ;
76
    }
77
    */
78
}
79