|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Repository; |
|
4
|
|
|
|
|
5
|
|
|
use App\Entity\Collection; |
|
6
|
|
|
use App\Entity\Item; |
|
7
|
|
|
use App\Entity\ItemCollection; |
|
8
|
|
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; |
|
9
|
|
|
use Doctrine\Common\Persistence\ManagerRegistry; |
|
|
|
|
|
|
10
|
|
|
use Doctrine\ORM\ORMException; |
|
11
|
|
|
use Doctrine\ORM\OptimisticLockException; |
|
12
|
|
|
use App\Repository\Exception\ItemCollectionNotFoundException; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* @method ItemCollection|null find($id, $lockMode = null, $lockVersion = null) |
|
16
|
|
|
* @method ItemCollection|null findOneBy(array $criteria, array $orderBy = null) |
|
17
|
|
|
* @method ItemCollection[] findAll() |
|
18
|
|
|
* @method ItemCollection[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) |
|
19
|
|
|
*/ |
|
20
|
|
|
class ItemCollectionRepository extends ServiceEntityRepository |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* @param ManagerRegistry $registry |
|
24
|
|
|
*/ |
|
25
|
|
|
public function __construct(ManagerRegistry $registry) |
|
26
|
|
|
{ |
|
27
|
|
|
parent::__construct($registry, ItemCollection::class); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @param Item $item |
|
32
|
|
|
* @param Collection $collection |
|
33
|
|
|
* @throws ItemCollectionNotFoundException |
|
34
|
|
|
* @return itemCollection |
|
35
|
|
|
*/ |
|
36
|
|
|
public function getItemCollection(Item $item, Collection $collection): ItemCollection |
|
37
|
|
|
{ |
|
38
|
|
|
if ($itemCollection = $this->findOneBy(['item'=> $item, 'collection'=>$collection])) { |
|
39
|
|
|
return $itemCollection; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
throw new ItemCollectionNotFoundException('itemCollection not found'); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @param ItemCollection $itemCollection |
|
47
|
|
|
* @throws \Doctrine\ORM\ORMException |
|
48
|
|
|
* @throws \Doctrine\ORM\OptimisticLockException |
|
49
|
|
|
*/ |
|
50
|
|
|
public function save(ItemCollection $itemCollection): void |
|
51
|
|
|
{ |
|
52
|
|
|
$em = $this->getEntityManager(); |
|
53
|
|
|
$em->persist($itemCollection); |
|
54
|
|
|
$em->flush(); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @param ItemCollection $itemCollection |
|
59
|
|
|
* @throws ORMException |
|
60
|
|
|
* @throws OptimisticLockException |
|
61
|
|
|
*/ |
|
62
|
|
|
public function delete(ItemCollection $itemCollection): void |
|
63
|
|
|
{ |
|
64
|
|
|
$em = $this->getEntityManager(); |
|
65
|
|
|
$em->remove($itemCollection); |
|
66
|
|
|
$em->flush(); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @param Item $item |
|
71
|
|
|
* @param Collection $collection |
|
72
|
|
|
* @return \App\Entity\ItemCollection|NULL |
|
73
|
|
|
*/ |
|
74
|
|
|
public function findItemCollection(Item $item, Collection $collection): ?ItemCollection |
|
75
|
|
|
{ |
|
76
|
|
|
return $this->findOneBy(['item' => $item, 'collection' => $collection]); |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths