1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AudioCoreEntity\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* RadioHit. |
9
|
|
|
* |
10
|
|
|
* @ORM\Table() |
11
|
|
|
* @ORM\Entity(repositoryClass="AudioCoreEntity\Repository\RadioHitRepository") |
12
|
|
|
*/ |
13
|
|
|
class RadioHit |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @var int |
17
|
|
|
* |
18
|
|
|
* @ORM\Column(name="id", type="integer") |
19
|
|
|
* @ORM\Id |
20
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
21
|
|
|
*/ |
22
|
|
|
private $id; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var string |
26
|
|
|
* |
27
|
|
|
* @ORM\Column(name="artist", type="string", length=255) |
28
|
|
|
*/ |
29
|
|
|
private $artist; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var string |
33
|
|
|
* |
34
|
|
|
* @ORM\Column(name="title", type="string", length=255) |
35
|
|
|
*/ |
36
|
|
|
private $title; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @ORM\ManyToMany(targetEntity="Genre", cascade={"persist", "detach", "refresh"}) |
40
|
|
|
* @ORM\JoinTable(name="radiohit_genre", |
41
|
|
|
* joinColumns={@ORM\JoinColumn(name="radiohit_id", referencedColumnName="id")}, |
42
|
|
|
* inverseJoinColumns={@ORM\JoinColumn(name="genre_id", referencedColumnName="id")} |
43
|
|
|
* ) |
44
|
|
|
* |
45
|
|
|
* @var ArrayCollection<Genre> |
46
|
|
|
**/ |
47
|
|
|
protected $genres; |
48
|
|
|
/** |
49
|
|
|
* @var \DateTime |
50
|
|
|
* |
51
|
|
|
* @ORM\Column(name="created", type="datetime") |
52
|
|
|
*/ |
53
|
|
|
private $created; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Get id. |
57
|
|
|
* |
58
|
|
|
* @return int |
59
|
|
|
*/ |
60
|
1 |
|
public function getId() |
61
|
|
|
{ |
62
|
1 |
|
return $this->id; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Set artist. |
67
|
|
|
* |
68
|
|
|
* @param string $artist |
69
|
|
|
* |
70
|
|
|
* @return RadioHit |
71
|
|
|
*/ |
72
|
1 |
|
public function setArtist($artist) |
73
|
|
|
{ |
74
|
1 |
|
$this->artist = $artist; |
75
|
|
|
|
76
|
1 |
|
return $this; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Get artist. |
81
|
|
|
* |
82
|
|
|
* @return string |
83
|
|
|
*/ |
84
|
1 |
|
public function getArtist() |
85
|
|
|
{ |
86
|
1 |
|
return $this->artist; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Set title. |
91
|
|
|
* |
92
|
|
|
* @param string $title |
93
|
|
|
* |
94
|
|
|
* @return RadioHit |
95
|
|
|
*/ |
96
|
1 |
|
public function setTitle($title) |
97
|
|
|
{ |
98
|
1 |
|
$this->title = $title; |
99
|
|
|
|
100
|
1 |
|
return $this; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* Get title. |
105
|
|
|
* |
106
|
|
|
* @return string |
107
|
|
|
*/ |
108
|
1 |
|
public function getTitle() |
109
|
|
|
{ |
110
|
1 |
|
return $this->title; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Set created. |
115
|
|
|
* |
116
|
|
|
* @param \DateTime $created |
117
|
|
|
* |
118
|
|
|
* @return RadioHit |
119
|
|
|
*/ |
120
|
1 |
|
public function setCreated($created) |
121
|
|
|
{ |
122
|
1 |
|
$this->created = $created; |
123
|
|
|
|
124
|
1 |
|
return $this; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* Get created. |
129
|
|
|
* |
130
|
|
|
* @return \DateTime |
131
|
|
|
*/ |
132
|
1 |
|
public function getCreated() |
133
|
|
|
{ |
134
|
1 |
|
return $this->created; |
135
|
|
|
} |
136
|
|
|
/** |
137
|
|
|
* Constructor. |
138
|
|
|
*/ |
139
|
1 |
|
public function __construct() |
140
|
|
|
{ |
141
|
1 |
|
$this->genres = new \Doctrine\Common\Collections\ArrayCollection(); |
142
|
1 |
|
$this->created = new \DateTime('now'); |
143
|
1 |
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Add genres. |
147
|
|
|
* |
148
|
|
|
* @param \AudioCoreEntity\Entity\Genre $genres |
149
|
|
|
* |
150
|
|
|
* @return RadioHit |
151
|
|
|
*/ |
152
|
1 |
|
public function addGenre(\AudioCoreEntity\Entity\Genre $genres) |
153
|
|
|
{ |
154
|
1 |
|
$this->genres->add($genres); |
155
|
|
|
|
156
|
1 |
|
return $this; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* Remove genres. |
161
|
|
|
* |
162
|
|
|
* @param \AudioCoreEntity\Entity\Genre $genres |
163
|
|
|
*/ |
164
|
1 |
|
public function removeGenre(\AudioCoreEntity\Entity\Genre $genres) |
165
|
|
|
{ |
166
|
1 |
|
$this->genres->removeElement($genres); |
167
|
1 |
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* Get genres. |
171
|
|
|
* |
172
|
|
|
* @return \Doctrine\Common\Collections\Collection |
173
|
|
|
*/ |
174
|
1 |
|
public function getGenres() |
175
|
|
|
{ |
176
|
1 |
|
return $this->genres; |
177
|
|
|
} |
178
|
|
|
} |
179
|
|
|
|