TeamGroup   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 31
c 1
b 0
f 0
dl 0
loc 55
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A setGroup() 0 3 1
A getGroup() 0 3 1
A setTeam() 0 3 1
A getTeam() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VideoGamesRecords\CoreBundle\Entity;
6
7
use ApiPlatform\Metadata\ApiProperty;
8
use ApiPlatform\Metadata\ApiResource;
9
use ApiPlatform\Metadata\Get;
10
use ApiPlatform\Metadata\GetCollection;
11
use Doctrine\ORM\Mapping as ORM;
12
use VideoGamesRecords\CoreBundle\Repository\TeamGroupRepository;
13
use VideoGamesRecords\CoreBundle\Traits\Entity\ChartRank0Trait;
14
use VideoGamesRecords\CoreBundle\Traits\Entity\ChartRank1Trait;
15
use VideoGamesRecords\CoreBundle\Traits\Entity\ChartRank2Trait;
16
use VideoGamesRecords\CoreBundle\Traits\Entity\ChartRank3Trait;
17
use VideoGamesRecords\CoreBundle\Traits\Entity\PointChartTrait;
18
use VideoGamesRecords\CoreBundle\Traits\Entity\RankMedalTrait;
19
use VideoGamesRecords\CoreBundle\Traits\Entity\RankPointChartTrait;
20
21
#[ORM\Table(name:'vgr_team_group')]
22
#[ORM\Entity(repositoryClass: TeamGroupRepository::class)]
23
#[ApiResource(
24
    operations: [
25
        new GetCollection(),
26
        new Get()
27
    ],
28
    normalizationContext: ['groups' => ['team-group:read']]
29
)]
30
class TeamGroup
31
{
32
    use RankPointChartTrait;
33
    use PointChartTrait;
34
    use RankMedalTrait;
35
    use ChartRank0Trait;
36
    use ChartRank1Trait;
37
    use ChartRank2Trait;
38
    use ChartRank3Trait;
39
40
    #[ApiProperty(identifier: false)]
41
    #[ORM\Id]
42
    #[ORM\ManyToOne(targetEntity: Team::class)]
43
    #[ORM\JoinColumn(name:'team_id', referencedColumnName:'id', nullable:false, onDelete:'CASCADE')]
44
    private Team $team;
45
46
    #[ApiProperty(identifier: false)]
47
    #[ORM\Id]
48
    #[ORM\ManyToOne(targetEntity: Group::class)]
49
    #[ORM\JoinColumn(name:'group_id', referencedColumnName:'id', nullable:false, onDelete:'CASCADE')]
50
    private Group $group;
51
52
    public function setGroup(Group $group): void
53
    {
54
        $this->group = $group;
55
    }
56
57
    public function getGroup(): Group
58
    {
59
        return $this->group;
60
    }
61
62
    public function setTeam(Team $team): void
63
    {
64
        $this->team = $team;
65
    }
66
67
    public function getTeam(): Team
68
    {
69
        return $this->team;
70
    }
71
72
    #[ApiProperty(identifier: true)]
73
    public function getId(): string
74
    {
75
        return sprintf('team=%d;group=%d', $this->team->getId(), $this->group->getId());
76
    }
77
}
78