1
|
|
|
<?php |
2
|
|
|
namespace Torakel\DatabaseBundle\Repository; |
3
|
|
|
|
4
|
|
|
use Doctrine\ORM\EntityRepository; |
|
|
|
|
5
|
|
|
use Torakel\DatabaseBundle\Entity\Matchday; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class MatchdayRepository |
9
|
|
|
* |
10
|
|
|
* This class handles all the database queries for the Matchday entity. |
11
|
|
|
* |
12
|
|
|
* @package Torakel\DatabaseBundle\Repository |
13
|
|
|
*/ |
14
|
|
|
class MatchdayRepository extends EntityRepository |
15
|
|
|
{ |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* findPreviousMatchdaySameRound |
19
|
|
|
* |
20
|
|
|
* Returns the previous matchday in the same round of a given matchday. |
21
|
|
|
* |
22
|
|
|
* @param Matchday $matchday |
23
|
|
|
* @return Matchday |
24
|
|
|
*/ |
25
|
|
|
public function findPreviousMatchdaySameRound(Matchday $matchday) |
26
|
|
|
{ |
27
|
|
|
$currentPosition = $matchday->getPosition(); |
28
|
|
|
$round = $matchday->getRound(); |
29
|
|
|
$previousPosition = $currentPosition - 1; |
30
|
|
|
if ($currentPosition == 0) { |
31
|
|
|
|
32
|
|
|
return null; |
33
|
|
|
} |
34
|
|
|
$previousMatchday = $this->getEntityManager() |
35
|
|
|
->createQuery( |
36
|
|
|
'SELECT m FROM TorakelDatabaseBundle:Matchday m WHERE m.position = :position AND m.round = :round' |
37
|
|
|
)->setParameter('position', $previousPosition)->setParameter('round', $round) |
38
|
|
|
->getResult(); |
39
|
|
|
if (!$previousMatchday) { |
40
|
|
|
return null; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
return array_shift($previousMatchday); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* findNextMatchdaySameRound |
48
|
|
|
* |
49
|
|
|
* Returns the next matchday in the same round of a given matchday. |
50
|
|
|
* |
51
|
|
|
* @param Matchday $matchday |
52
|
|
|
* @return Matchday |
53
|
|
|
*/ |
54
|
|
|
public function findNextMatchdaySameRound(Matchday $matchday) |
55
|
|
|
{ |
56
|
|
|
$currentPosition = $matchday->getPosition(); |
57
|
|
|
$round = $matchday->getRound(); |
58
|
|
|
$nextPosition = $currentPosition + 1; |
59
|
|
|
$nextMatchday = $this->getEntityManager() |
60
|
|
|
->createQuery( |
61
|
|
|
'SELECT m FROM TorakelDatabaseBundle:Matchday m WHERE m.position = :position AND m.round = :round' |
62
|
|
|
)->setParameter('position', $nextPosition)->setParameter('round', $round) |
63
|
|
|
->getResult(); |
64
|
|
|
if (!$nextMatchday) { |
65
|
|
|
return null; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
return array_shift($nextMatchday); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* findAllMatchdaysOfRoundByMatchday |
73
|
|
|
* |
74
|
|
|
* Returns all matchdays of a round for a given matchday. |
75
|
|
|
* |
76
|
|
|
* @param Matchday $matchday |
77
|
|
|
* @return Matchday |
78
|
|
|
*/ |
79
|
|
|
public function findAllMatchdaysOfRoundByMatchday(Matchday $matchday) |
80
|
|
|
{ |
81
|
|
|
return $this->getEntityManager() |
82
|
|
|
->createQuery( |
83
|
|
|
'SELECT m FROM TorakelDatabaseBundle:Matchday m JOIN TorakelDatabaseBundle:Round r WITH m.round = r WHERE r.event = :event ORDER BY m.position ASC' |
84
|
|
|
)->setParameter('event', $matchday->getRound()->getEvent()) |
85
|
|
|
->getResult(); |
86
|
|
|
} |
87
|
|
|
} |
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