Passed
Pull Request — dev (#2038)
by Janko
10:55
created

SkillEnhancementLogRepository::getForCrewman()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 1
dl 0
loc 14
ccs 11
cts 11
cp 1
crap 1
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Orm\Repository;
6
7
use Doctrine\ORM\EntityRepository;
8
use Override;
0 ignored issues
show
Bug introduced by
The type Override 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 Stu\Orm\Entity\CrewInterface;
10
use Stu\Orm\Entity\SkillEnhancementLog;
11
use Stu\Orm\Entity\SkillEnhancementLogInterface;
12
13
/**
14
 * @extends EntityRepository<SkillEnhancementLog>
15
 */
16
final class SkillEnhancementLogRepository extends EntityRepository implements SkillEnhancementLogRepositoryInterface
17
{
18
19
    #[Override]
20
    public function prototype(): SkillEnhancementLogInterface
21
    {
22
        return new SkillEnhancementLog();
23
    }
24
25
    #[Override]
26
    public function save(SkillEnhancementLogInterface $post): void
27
    {
28
        $em = $this->getEntityManager();
29
30
        $em->persist($post);
31
    }
32
33 1
    #[Override]
34
    public function getForCrewman(CrewInterface $crew): array
35
    {
36 1
        return $this->getEntityManager()
37 1
            ->createQuery(
38 1
                sprintf(
39 1
                    'SELECT el FROM %s el
40
                        WHERE el.crew_id = :crewId
41 1
                        ORDER BY el.id DESC',
42 1
                    SkillEnhancementLog::class
43 1
                )
44 1
            )
45 1
            ->setParameter('crewId', $crew->getId())
46 1
            ->getResult();
47
    }
48
}
49