processData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
c 2
b 0
f 0
dl 0
loc 11
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Oliverde8\PhpEtlBundle\Etl\Operation\Cleanup;
6
7
use Doctrine\ORM\EntityManagerInterface;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\EntityManagerInterface 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 Oliverde8\Component\PhpEtl\ChainOperation\AbstractChainOperation;
9
use Oliverde8\Component\PhpEtl\Item\DataItemInterface;
10
use Oliverde8\Component\PhpEtl\Item\ItemInterface;
11
use Oliverde8\Component\PhpEtl\Model\ExecutionContext;
12
use Oliverde8\PhpEtlBundle\Entity\EtlExecution;
13
14
class DeleteEntityForOldExecutionOperation extends AbstractChainOperation
15
{
16
    protected EntityManagerInterface $em;
17
18
    /**
19
     * DeleteEntityForOldExecutionOperation constructor.
20
     * @param EntityManagerInterface $em
21
     */
22
    public function __construct(EntityManagerInterface $em)
23
    {
24
        $this->em = $em;
25
    }
26
27
    protected function processData(DataItemInterface $item, ExecutionContext $context): ItemInterface
0 ignored issues
show
Unused Code introduced by
The parameter $context is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

27
    protected function processData(DataItemInterface $item, /** @scrutinizer ignore-unused */ ExecutionContext $context): ItemInterface

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
28
    {
29
        /** @var EtlExecution $entity */
30
        $entity = $item->getData();
31
32
        $this->em->remove($entity);
33
        $this->em->flush();
34
        // Method is currently deprecated but has been un-deprecated in doctrine 3.
35
        $this->em->detach($entity);
36
37
        return $item;
38
    }
39
}
40