Passed
Push — master ( ad7b81...1c3353 )
by Janko
35:52
created

MapRegion::getAstronomicalEntries()   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 0
dl 0
loc 4
ccs 0
cts 2
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\Common\Collections\ArrayCollection;
8
use Doctrine\Common\Collections\Collection;
9
use Doctrine\ORM\Mapping\Column;
10
use Doctrine\ORM\Mapping\Entity;
11
use Doctrine\ORM\Mapping\GeneratedValue;
12
use Doctrine\ORM\Mapping\Id;
13
use Doctrine\ORM\Mapping\JoinColumn;
14
use Doctrine\ORM\Mapping\ManyToOne;
15
use Doctrine\ORM\Mapping\OneToMany;
16
use Doctrine\ORM\Mapping\Table;
17
use Override;
0 ignored issues
show
Bug introduced by
The type Override was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use Stu\Orm\Repository\MapRegionRepository;
19
20
#[Table(name: 'stu_map_regions')]
21
#[Entity(repositoryClass: MapRegionRepository::class)]
22
class MapRegion implements MapRegionInterface
23
{
24
    #[Id]
25
    #[Column(type: 'integer')]
26
    #[GeneratedValue(strategy: 'IDENTITY')]
27
    private int $id;
28
29
    #[Column(type: 'string')]
30
    private string $description = '';
31
32
    #[Column(type: 'integer', nullable: true)]
33
    private ?int $database_id = 0;
0 ignored issues
show
introduced by
The private property $database_id is not used, and could be removed.
Loading history...
34
35
    #[ManyToOne(targetEntity: 'DatabaseEntry')]
36
    #[JoinColumn(name: 'database_id', referencedColumnName: 'id')]
37
    private ?DatabaseEntryInterface $databaseEntry = null;
38
39
    /** @var ArrayCollection<int, AstronomicalEntryInterface> */
40
    #[OneToMany(targetEntity: 'AstronomicalEntry', mappedBy: 'region', indexBy: 'user_id', fetch: 'EXTRA_LAZY')]
41
    private Collection $astronomicalEntries;
42
43
    public function __construct()
44
    {
45
        $this->astronomicalEntries = new ArrayCollection();
46
    }
47
48
    #[Override]
49
    public function getId(): int
50
    {
51
        return $this->id;
52
    }
53
54
    #[Override]
55
    public function getDescription(): string
56
    {
57
        return $this->description;
58
    }
59
60
    #[Override]
61
    public function setDescription(string $description): MapRegionInterface
62
    {
63
        $this->description = $description;
64
65
        return $this;
66
    }
67
68
    #[Override]
69
    public function getDatabaseEntry(): ?DatabaseEntryInterface
70
    {
71
        return $this->databaseEntry;
72
    }
73
74
    #[Override]
75
    public function setDatabaseEntry(?DatabaseEntryInterface $databaseEntry): MapRegionInterface
76
    {
77
        $this->databaseEntry = $databaseEntry;
78
79
        return $this;
80
    }
81
82
    #[Override]
83
    public function getAstronomicalEntries(): Collection
84
    {
85
        return $this->astronomicalEntries;
86
    }
87
}
88