Passed
Pull Request — 2.6 (#7750)
by
unknown
10:46
created

Power::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nop 3
dl 0
loc 5
rs 10
nc 1
1
<?php
2
namespace Doctrine\Tests\Models\Issue7735;
3
4
use Doctrine\ORM\Mapping\Cache;
5
use Doctrine\ORM\Mapping\Column;
6
use Doctrine\ORM\Mapping\Entity;
7
use Doctrine\ORM\Mapping\GeneratedValue;
8
use Doctrine\ORM\Mapping\Id;
9
use Doctrine\ORM\Mapping\JoinColumn;
10
use Doctrine\ORM\Mapping\OneToOne;
11
use Doctrine\ORM\Mapping\Table;
12
13
/**
14
 * @Entity
15
 * @Table(name="power")
16
 * @Cache(usage="READ_ONLY", region="power")
17
 */
18
class Power
19
{
20
    /**
21
     * @Id
22
     * @Column(type="integer")
23
     * @GeneratedValue(strategy="IDENTITY")
24
     */
25
    private $id;
0 ignored issues
show
introduced by
The private property $id is not used, and could be removed.
Loading history...
26
27
    /**
28
     * @var integer
29
     * @Column(name="horse_power", type="integer", nullable=false)
30
     */
31
    protected $horsePower;
32
33
    /**
34
     * @var integer
35
     * @Column(name="kilowatt", type="integer", nullable=false)
36
     */
37
    protected $kilowatt;
38
39
    /**
40
     * @var Engine
41
     * @OneToOne(targetEntity="Engine")
42
     * @Cache("READ_ONLY")
43
     * @JoinColumn(name="engine_id", referencedColumnName="id", onDelete="CASCADE")
44
     */
45
    protected $engine;
46
47
    /**
48
     * Power constructor.
49
     * @param int $horsePower
50
     * @param int $kilowatt
51
     * @param Engine $engine
52
     */
53
    public function __construct(int $horsePower, int $kilowatt, Engine $engine)
54
    {
55
        $this->horsePower = $horsePower;
56
        $this->kilowatt = $kilowatt;
57
        $this->engine = $engine;
58
    }
59
60
    /**
61
     * @return int
62
     */
63
    public function getHorsePower(): int
64
    {
65
        return $this->horsePower;
66
    }
67
68
    /**
69
     * @return int
70
     */
71
    public function getKilowatt(): int
72
    {
73
        return $this->kilowatt;
74
    }
75
76
    /**
77
     * @return Engine
78
     */
79
    public function getEngine(): Engine
80
    {
81
        return $this->engine;
82
    }
83
}
84