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