Passed
Push — dev ( b01017...737777 )
by Janko
05:10
created

StationShipRepair::setShip()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
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\JoinColumn;
12
use Doctrine\ORM\Mapping\ManyToOne;
13
use Doctrine\ORM\Mapping\Table;
14
use Stu\Orm\Repository\StationShipRepairRepository;
15
16
#[Table(name: 'stu_station_shiprepair')]
17
#[Entity(repositoryClass: StationShipRepairRepository::class)]
18
class StationShipRepair
19
{
20
    #[Id]
21
    #[Column(type: 'integer')]
22
    #[GeneratedValue(strategy: 'IDENTITY')]
23
    private int $id;
24
25
    #[Column(type: 'integer')]
26
    private int $station_id;
27
28
    #[Column(type: 'integer')]
29
    private int $ship_id;
30
31
    #[ManyToOne(targetEntity: Station::class)]
32
    #[JoinColumn(name: 'station_id', nullable: false, referencedColumnName: 'id', onDelete: 'CASCADE')]
33
    private Station $station;
34
35
    #[ManyToOne(targetEntity: Ship::class)]
36
    #[JoinColumn(name: 'ship_id', nullable: false, referencedColumnName: 'id', onDelete: 'CASCADE')]
37
    private Ship $ship;
38
39
    public function getId(): int
40
    {
41
        return $this->id;
42
    }
43
44
    public function getStationId(): int
45
    {
46
        return $this->station_id;
47
    }
48
49
    public function getShipId(): int
50
    {
51
        return $this->ship_id;
52
    }
53
54 2
    public function getStation(): Station
55
    {
56 2
        return $this->station;
57
    }
58
59
    public function setStation(Station $station): StationShipRepair
60
    {
61
        $this->station = $station;
62
        return $this;
63
    }
64
65 2
    public function getShip(): Ship
66
    {
67 2
        return $this->ship;
68
    }
69
70
    public function setShip(Ship $ship): StationShipRepair
71
    {
72
        $this->ship = $ship;
73
        return $this;
74
    }
75
}
76