Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 15
n/a
0 / 0
n/a
0 / 0
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
DoctrineUserSetRepository
0.00% covered (danger)
0.00%
0 / 14
n/a
0 / 0
n/a
0 / 0
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
n/a
0 / 0
n/a
0 / 0
0.00% covered (danger)
0.00%
0 / 1
2
 findByUserAndExternalIds
0.00% covered (danger)
0.00%
0 / 13
n/a
0 / 0
n/a
0 / 0
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\CollectionManagement\Infrastructure\Persistence\Doctrine\Repository;
4
5use App\CollectionManagement\Domain\Model\Local\Set;
6use App\CollectionManagement\Domain\Model\Local\UserSet;
7use App\CollectionManagement\Domain\Model\UserSetCollection;
8use App\CollectionManagement\Infrastructure\Persistence\Doctrine\Entity\DoctrineUserSet;
9use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
10use Doctrine\Persistence\ManagerRegistry;
11use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
12
13/**
14 * @author W.Zwertvaegher
15 * @extends ServiceEntityRepository<Set>
16 */
17#[Autoconfigure]
18class DoctrineUserSetRepository extends ServiceEntityRepository implements \App\CollectionManagement\Domain\Port\Driven\UserSetRepository
19{
20    public function __construct(ManagerRegistry $managerRegistry)
21    {
22        parent::__construct($managerRegistry, Set::class);
23    }
24
25    public function findByUserAndExternalIds(string $userId, array $externalIds): UserSetCollection
26    {
27        return new UserSetCollection(
28            array_map(
29                fn (DoctrineUserSet $doctrineUserSet): UserSet => $doctrineUserSet->toDomain(),
30                $this->createQueryBuilder('us')
31                    ->join('us.set', 's')
32                    ->where('us.user = :userId')
33                    ->andWhere('s.externalId IN (:externalIds)')
34                    ->setParameter('userId', $userId)
35                    ->setParameter('externalIds', $externalIds)
36                    ->getQuery()
37                    ->getResult()
38            )
39        );
40    }
41}

Branches

Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once. Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.