ModuleCost   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 31
dl 0
loc 74
ccs 0
cts 19
cp 0
rs 10
c 0
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setModuleId() 0 5 1
A getCommodity() 0 3 1
A getId() 0 3 1
A getCommodityId() 0 3 1
A setAmount() 0 5 1
A getModuleId() 0 3 1
A setCommodityId() 0 5 1
A getAmount() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Orm\Entity;
6
7
use Doctrine\ORM\Mapping\Column;
8
use Doctrine\ORM\Mapping\Entity;
9
use Doctrine\ORM\Mapping\GeneratedValue;
10
use Doctrine\ORM\Mapping\Id;
11
use Doctrine\ORM\Mapping\Index;
12
use Doctrine\ORM\Mapping\JoinColumn;
13
use Doctrine\ORM\Mapping\ManyToOne;
14
use Doctrine\ORM\Mapping\Table;
15
use Stu\Orm\Repository\ModuleCostRepository;
16
17
#[Table(name: 'stu_modules_cost')]
18
#[Index(name: 'module_cost_module_idx', columns: ['module_id'])]
19
#[Entity(repositoryClass: ModuleCostRepository::class)]
20
class ModuleCost
21
{
22
    #[Id]
23
    #[Column(type: 'integer')]
24
    #[GeneratedValue(strategy: 'IDENTITY')]
25
    private int $id;
26
27
    #[Column(type: 'integer')]
28
    private int $module_id = 0;
29
30
    #[Column(type: 'integer')]
31
    private int $commodity_id = 0;
32
33
    #[Column(type: 'integer')]
34
    private int $count = 0;
35
36
    #[ManyToOne(targetEntity: Commodity::class)]
37
    #[JoinColumn(name: 'commodity_id', nullable: false, referencedColumnName: 'id', onDelete: 'CASCADE')]
38
    private Commodity $commodity;
39
40
    /**
41
     * @var Module
42
     */
43
    #[ManyToOne(targetEntity: Module::class, inversedBy: 'buildingCosts')]
44
    #[JoinColumn(name: 'module_id', nullable: false, referencedColumnName: 'id', onDelete: 'CASCADE')]
45
    private $module;
0 ignored issues
show
introduced by
The private property $module is not used, and could be removed.
Loading history...
46
47
    public function getId(): int
48
    {
49
        return $this->id;
50
    }
51
52
    public function getModuleId(): int
53
    {
54
        return $this->module_id;
55
    }
56
57
    public function setModuleId(int $moduleId): ModuleCost
58
    {
59
        $this->module_id = $moduleId;
60
61
        return $this;
62
    }
63
64
    public function getCommodityId(): int
65
    {
66
        return $this->commodity_id;
67
    }
68
69
    public function setCommodityId(int $commodityId): ModuleCost
70
    {
71
        $this->commodity_id = $commodityId;
72
73
        return $this;
74
    }
75
76
    public function getAmount(): int
77
    {
78
        return $this->count;
79
    }
80
81
    public function setAmount(int $amount): ModuleCost
82
    {
83
        $this->count = $amount;
84
85
        return $this;
86
    }
87
88
    public function getCommodity(): Commodity
89
    {
90
        return $this->commodity;
91
    }
92
}
93