Passed
Branch 0.1 (d41d7c)
by Nils
02:15
created

MatchdayTable::getSlug()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Torakel\DatabaseBundle\Entity;
3
4
use Doctrine\Common\Collections\ArrayCollection;
5
use Doctrine\ORM\Mapping as ORM;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping 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...
6
7
/**
8
 * @ORM\Entity
9
 * @ORM\HasLifecycleCallbacks
10
 * @ORM\Table(name="matchday_table")
11
 */
12
class MatchdayTable
13
{
14
15
    /**
16
     * @var integer
17
     * @ORM\Column(type="integer")
18
     * @ORM\Id
19
     * @ORM\GeneratedValue(strategy="AUTO")
20
     */
21
    private $id;
22
23
    /**
24
     * @var string
25
     * @ORM\Column(type="string")
26
     */
27
    protected $slug;
28
29
    /**
30
     * @var \Torakel\DatabaseBundle\Entity\Matchday
31
     * @ORM\OneToOne(targetEntity="\Torakel\DatabaseBundle\Entity\Matchday", inversedBy="matchdayTable")
32
     * @ORM\JoinColumn(name="matchday_id", referencedColumnName="id")
33
     */
34
    protected $matchday;
35
36
    /**
37
     * @var \Doctrine\Common\Collections\ArrayCollection;
38
     * @ORM\OneToMany(targetEntity="\Torakel\DatabaseBundle\Entity\TablePosition", mappedBy="matchdayTable")
39
     * @ORM\OrderBy({"position" = "ASC"})
40
     */
41
    protected $tablePositions;
42
43
    /**
44
     * @var \DateTime
45
     * @ORM\Column(type="datetime", name="created_at")
46
     */
47
    protected $createdAt;
48
49
    /**
50
     * @var \DateTime
51
     * @ORM\Column(type="datetime", name="updated_at", nullable=true)
52
     */
53
    protected $updatedAt;
54
55
    /**
56
     * Constructor
57
     */
58 3
    public function __construct()
59
    {
60 3
        $this->homeGames = new \Doctrine\Common\Collections\ArrayCollection();
0 ignored issues
show
Bug Best Practice introduced by
The property homeGames does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
61 3
        $this->tablePositions = new \Doctrine\Common\Collections\ArrayCollection();
62 3
    }
63
64
    /**
65
     * @ORM\PrePersist
66
     */
67 1
    public function prePersist()
68
    {
69 1
        $this->createdAt = new \DateTime();
70 1
    }
71
72
    /**
73
     * @ORM\PreUpdate
74
     */
75 1
    public function preUpdate()
76
    {
77 1
        $this->updatedAt = new \DateTime();
78 1
    }
79
80
    /**
81
     * Get id
82
     *
83
     * @return integer
84
     */
85 1
    public function getId()
86
    {
87 1
        return $this->id;
88
    }
89
90
    /**
91
     * Set slug
92
     *
93
     * @param string $slug
94
     *
95
     * @return Table
96
     */
97 1
    public function setSlug($slug)
98
    {
99 1
        $this->slug = $slug;
100
101 1
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Torakel\DatabaseBundle\Entity\MatchdayTable which is incompatible with the documented return type Torakel\DatabaseBundle\Entity\Table.
Loading history...
102
    }
103
104
    /**
105
     * Get slug
106
     *
107
     * @return string
108
     */
109 1
    public function getSlug()
110
    {
111 1
        return $this->slug;
112
    }
113
114
    /**
115
     * Set createdAt
116
     *
117
     * @param \DateTime $createdAt
118
     *
119
     * @return Table
120
     */
121 1
    public function setCreatedAt($createdAt)
122
    {
123 1
        $this->createdAt = $createdAt;
124
125 1
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Torakel\DatabaseBundle\Entity\MatchdayTable which is incompatible with the documented return type Torakel\DatabaseBundle\Entity\Table.
Loading history...
126
    }
127
128
    /**
129
     * Get createdAt
130
     *
131
     * @return \DateTime
132
     */
133 1
    public function getCreatedAt()
134
    {
135 1
        return $this->createdAt;
136
    }
137
138
    /**
139
     * Set updatedAt
140
     *
141
     * @param \DateTime $updatedAt
142
     *
143
     * @return Table
144
     */
145 1
    public function setUpdatedAt($updatedAt)
146
    {
147 1
        $this->updatedAt = $updatedAt;
148
149 1
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Torakel\DatabaseBundle\Entity\MatchdayTable which is incompatible with the documented return type Torakel\DatabaseBundle\Entity\Table.
Loading history...
150
    }
151
152
    /**
153
     * Get updatedAt
154
     *
155
     * @return \DateTime
156
     */
157 1
    public function getUpdatedAt()
158
    {
159 1
        return $this->updatedAt;
160
    }
161
162
    /**
163
     * Set matchday
164
     *
165
     * @param \Torakel\DatabaseBundle\Entity\Matchday $matchday
166
     *
167
     * @return Table
168
     */
169 1
    public function setMatchday(\Torakel\DatabaseBundle\Entity\Matchday $matchday = null)
170
    {
171 1
        $this->matchday = $matchday;
172
173 1
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Torakel\DatabaseBundle\Entity\MatchdayTable which is incompatible with the documented return type Torakel\DatabaseBundle\Entity\Table.
Loading history...
174
    }
175
176
    /**
177
     * Get matchday
178
     *
179
     * @return \Torakel\DatabaseBundle\Entity\Matchday
180
     */
181 1
    public function getMatchday()
182
    {
183 1
        return $this->matchday;
184
    }
185
186
    /**
187
     * Add tablePosition
188
     *
189
     * @param \Torakel\DatabaseBundle\Entity\TablePosition $tablePosition
190
     *
191
     * @return Table
192
     */
193 1
    public function addTablePosition(\Torakel\DatabaseBundle\Entity\TablePosition $tablePosition)
194
    {
195 1
        $this->tablePositions[] = $tablePosition;
196
197 1
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Torakel\DatabaseBundle\Entity\MatchdayTable which is incompatible with the documented return type Torakel\DatabaseBundle\Entity\Table.
Loading history...
198
    }
199
200
    /**
201
     * Remove tablePosition
202
     *
203
     * @param \Torakel\DatabaseBundle\Entity\TablePosition $tablePosition
204
     */
205 1
    public function removeTablePosition(\Torakel\DatabaseBundle\Entity\TablePosition $tablePosition)
206
    {
207 1
        $this->tablePositions->removeElement($tablePosition);
208 1
    }
209
210
    /**
211
     * Get tablePositions
212
     *
213
     * @return \Doctrine\Common\Collections\Collection
214
     */
215 1
    public function getTablePositions()
216
    {
217 1
        return $this->tablePositions;
218
    }
219
}
220