1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @author Rafał Muszyński <[email protected]> |
5
|
|
|
* @copyright 2013 Sourcefabric o.p.s. |
6
|
|
|
* @license http://www.gnu.org/licenses/gpl-3.0.txt |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace Newscoop\PaywallBundle\Entity; |
10
|
|
|
|
11
|
|
|
use Doctrine\ORM\Mapping as ORM; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Trials entity. |
15
|
|
|
* |
16
|
|
|
* @ORM\Entity() |
17
|
|
|
* @ORM\Table(name="plugin_paywall_trials") |
18
|
|
|
*/ |
19
|
|
|
class Trial |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @ORM\Id() |
23
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
24
|
|
|
* @ORM\Column(type="integer", name="id") |
25
|
|
|
* |
26
|
|
|
* @var int |
27
|
|
|
*/ |
28
|
|
|
protected $id; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @ORM\ManyToOne(targetEntity="Newscoop\Entity\User") |
32
|
|
|
* @ORM\JoinColumn(name="IdUser", referencedColumnName="Id") |
33
|
|
|
* |
34
|
|
|
* @var Newscoop\Entity\User |
35
|
|
|
*/ |
36
|
|
|
protected $user; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @ORM\Column(type="boolean", name="had_trial") |
40
|
|
|
* |
41
|
|
|
* @var bool |
42
|
|
|
*/ |
43
|
|
|
protected $hadTrial; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @ORM\Column(type="datetime", name="trial_finish") |
47
|
|
|
* |
48
|
|
|
* @var datetime |
49
|
|
|
*/ |
50
|
|
|
protected $finishTrial; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @ORM\ManyToOne(targetEntity="Newscoop\PaywallBundle\Entity\Subscription") |
54
|
|
|
* @ORM\JoinColumn(name="trial_for_subscription", referencedColumnName="id") |
55
|
|
|
* |
56
|
|
|
* @var Newscoop\PaywallBundle\Entity\Subscriptions |
57
|
|
|
*/ |
58
|
|
|
protected $subscription; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @ORM\Column(type="datetime", name="trial_created_at") |
62
|
|
|
* |
63
|
|
|
* @var string |
64
|
|
|
*/ |
65
|
|
|
protected $created_at; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @ORM\Column(type="boolean", name="is_active") |
69
|
|
|
* |
70
|
|
|
* @var bool |
71
|
|
|
*/ |
72
|
|
|
protected $is_active; |
73
|
|
|
|
74
|
|
|
public function __construct() |
75
|
|
|
{ |
76
|
|
|
$this->setCreatedAt(new \DateTime()); |
77
|
|
|
$this->setIsActive(true); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Get id. |
82
|
|
|
* |
83
|
|
|
* @return int |
84
|
|
|
*/ |
85
|
|
|
public function getId() |
86
|
|
|
{ |
87
|
|
|
return $this->id; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Get user. |
92
|
|
|
* |
93
|
|
|
* @return Newscoop\Entity\User |
94
|
|
|
*/ |
95
|
|
|
public function getUser() |
96
|
|
|
{ |
97
|
|
|
return $this->user; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Set user. |
102
|
|
|
* |
103
|
|
|
* @param Newscoop\Entity\User $user |
104
|
|
|
* |
105
|
|
|
* @return Newscoop\Entity\User |
106
|
|
|
*/ |
107
|
|
|
public function setUser($user) |
108
|
|
|
{ |
109
|
|
|
$this->user = $user; |
110
|
|
|
|
111
|
|
|
return $user; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* Get had trial. |
116
|
|
|
* |
117
|
|
|
* @return bool |
118
|
|
|
*/ |
119
|
|
|
public function getHadTrial() |
120
|
|
|
{ |
121
|
|
|
return $this->hadTrial; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Set had trial. |
126
|
|
|
* |
127
|
|
|
* @param bool $hadTrial |
128
|
|
|
* |
129
|
|
|
* @return bool |
130
|
|
|
*/ |
131
|
|
|
public function setHadTrial($hadTrial) |
132
|
|
|
{ |
133
|
|
|
$this->hadTrial = $hadTrial; |
134
|
|
|
|
135
|
|
|
return $this; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* Get trial finish date. |
140
|
|
|
* |
141
|
|
|
* @return datetime |
142
|
|
|
*/ |
143
|
|
|
public function getFinishTrial() |
144
|
|
|
{ |
145
|
|
|
return $this->finishTrial; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* Set finish Trial. |
150
|
|
|
* |
151
|
|
|
* @param datetime $finishTrial |
152
|
|
|
* |
153
|
|
|
* @return datetime |
154
|
|
|
*/ |
155
|
|
|
public function setFinishTrial($finishTrial) |
156
|
|
|
{ |
157
|
|
|
$this->finishTrial = $finishTrial; |
158
|
|
|
|
159
|
|
|
return $this; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* Get status. |
164
|
|
|
* |
165
|
|
|
* @return bool |
166
|
|
|
*/ |
167
|
|
|
public function getIsActive() |
168
|
|
|
{ |
169
|
|
|
return $this->is_active; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* Set status. |
174
|
|
|
* |
175
|
|
|
* @param bool $is_active |
176
|
|
|
* |
177
|
|
|
* @return bool |
178
|
|
|
*/ |
179
|
|
|
public function setIsActive($is_active) |
180
|
|
|
{ |
181
|
|
|
$this->is_active = $is_active; |
182
|
|
|
|
183
|
|
|
return $this; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* Get create date. |
188
|
|
|
* |
189
|
|
|
* @return datetime |
190
|
|
|
*/ |
191
|
|
|
public function getCreatedAt() |
192
|
|
|
{ |
193
|
|
|
return $this->created_at; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* Set create date. |
198
|
|
|
* |
199
|
|
|
* @param datetime $created_at |
200
|
|
|
* |
201
|
|
|
* @return datetime |
202
|
|
|
*/ |
203
|
|
|
public function setCreatedAt(\DateTime $created_at) |
204
|
|
|
{ |
205
|
|
|
$this->created_at = $created_at; |
|
|
|
|
206
|
|
|
|
207
|
|
|
return $this; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* Get subscription. |
212
|
|
|
* |
213
|
|
|
* @return Newscoop\PaywallBundle\Entity\Subscriptions |
214
|
|
|
*/ |
215
|
|
|
public function getSubscription() |
216
|
|
|
{ |
217
|
|
|
return $this->subscription; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* Get subscription. |
222
|
|
|
* |
223
|
|
|
* @param Newscoop\PaywallBundle\Entity\Subscription $subscription |
224
|
|
|
* |
225
|
|
|
* @return Newscoop\PaywallBundle\Entity\Subscriptions |
226
|
|
|
*/ |
227
|
|
|
public function setSubscription($subscription) |
228
|
|
|
{ |
229
|
|
|
$this->subscription = $subscription; |
|
|
|
|
230
|
|
|
|
231
|
|
|
return $subscription; |
232
|
|
|
} |
233
|
|
|
} |
234
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..