1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the LoopBackApiBundle package. |
5
|
|
|
* |
6
|
|
|
* (c) Théo FIDRY <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Fidry\LoopBackApiBundle\Tests\Functional\Bundle\TestBundle\Entity; |
13
|
|
|
|
14
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
15
|
|
|
use Doctrine\ORM\Mapping as ORM; |
16
|
|
|
use Dunglas\ApiBundle\Annotation\Iri; |
17
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Dummy. |
21
|
|
|
* |
22
|
|
|
* @author Théo FIDRY <[email protected]> |
23
|
|
|
* |
24
|
|
|
* @ORM\Entity |
25
|
|
|
*/ |
26
|
|
|
class AnotherDummy |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* @var int The id. |
30
|
|
|
* |
31
|
|
|
* @ORM\Column(type="integer") |
32
|
|
|
* @ORM\Id |
33
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
34
|
|
|
*/ |
35
|
|
|
private $id; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var string The dummy name alias. |
39
|
|
|
* |
40
|
|
|
* @ORM\Column(nullable=true) |
41
|
|
|
* @Iri("https://schema.org/alternateName") |
42
|
|
|
*/ |
43
|
|
|
private $alias; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var \DateTime A dummy date. |
47
|
|
|
* |
48
|
|
|
* @ORM\Column(type="datetime", nullable=true) |
49
|
|
|
* @Assert\DateTime |
50
|
|
|
*/ |
51
|
|
|
public $dummyDate; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var bool |
55
|
|
|
* |
56
|
|
|
* @ORM\Column(nullable=true) |
57
|
|
|
*/ |
58
|
|
|
public $isEnabled; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var string The dummy name. |
62
|
|
|
* |
63
|
|
|
* @ORM\Column |
64
|
|
|
* @Assert\NotBlank |
65
|
|
|
* @Iri("http://schema.org/name") |
66
|
|
|
*/ |
67
|
|
|
private $name; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @var float The dummy price. |
71
|
|
|
* |
72
|
|
|
* @ORM\Column(type="float", nullable=true) |
73
|
|
|
*/ |
74
|
|
|
private $price; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @var RelatedDummy A related dummy. |
78
|
|
|
* |
79
|
|
|
* @ORM\ManyToOne(targetEntity="RelatedDummy") |
80
|
|
|
*/ |
81
|
|
|
public $relatedDummy; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @var ArrayCollection Several dummies. |
85
|
|
|
* |
86
|
|
|
* @ORM\ManyToMany(targetEntity="RelatedDummy") |
87
|
|
|
*/ |
88
|
|
|
public $relatedDummies; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Constructor. |
92
|
|
|
*/ |
93
|
|
|
public function __construct() |
94
|
|
|
{ |
95
|
|
|
$this->relatedDummies = new ArrayCollection(); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @return int |
100
|
|
|
*/ |
101
|
|
|
public function getId() |
102
|
|
|
{ |
103
|
|
|
return $this->id; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @param $name |
108
|
|
|
*/ |
109
|
|
|
public function setName($name) |
110
|
|
|
{ |
111
|
|
|
$this->name = $name; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @return string |
116
|
|
|
*/ |
117
|
|
|
public function getName() |
118
|
|
|
{ |
119
|
|
|
return $this->name; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @param $alias |
124
|
|
|
*/ |
125
|
|
|
public function setAlias($alias) |
126
|
|
|
{ |
127
|
|
|
$this->alias = $alias; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @return string |
132
|
|
|
*/ |
133
|
|
|
public function getAlias() |
134
|
|
|
{ |
135
|
|
|
return $this->alias; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @param \DateTime $dummyDate |
140
|
|
|
*/ |
141
|
|
|
public function setDummyDate(\DateTime $dummyDate) |
142
|
|
|
{ |
143
|
|
|
$this->dummyDate = $dummyDate; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @return \DateTime |
148
|
|
|
*/ |
149
|
|
|
public function getDummyDate() |
150
|
|
|
{ |
151
|
|
|
return $this->dummyDate; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* Disables entity. |
156
|
|
|
* |
157
|
|
|
* @return $this |
158
|
|
|
*/ |
159
|
|
|
public function disable() |
160
|
|
|
{ |
161
|
|
|
$this->isEnabled = false; |
162
|
|
|
|
163
|
|
|
return $this; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Enables entity. |
168
|
|
|
* |
169
|
|
|
* @return $this |
170
|
|
|
*/ |
171
|
|
|
public function enable() |
172
|
|
|
{ |
173
|
|
|
$this->isEnabled = true; |
174
|
|
|
|
175
|
|
|
return $this; |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* Gets IsEnabled. |
180
|
|
|
* |
181
|
|
|
* @return string|null |
182
|
|
|
*/ |
183
|
|
|
public function isEnabled() |
184
|
|
|
{ |
185
|
|
|
return $this->isEnabled; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* Sets Price. |
190
|
|
|
* |
191
|
|
|
* @param float $price |
192
|
|
|
* |
193
|
|
|
* @return $this |
194
|
|
|
*/ |
195
|
|
|
public function setPrice($price) |
196
|
|
|
{ |
197
|
|
|
$this->price = $price; |
198
|
|
|
|
199
|
|
|
return $this; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* Gets Price. |
204
|
|
|
* |
205
|
|
|
* @return float|null |
206
|
|
|
*/ |
207
|
|
|
public function getPrice() |
208
|
|
|
{ |
209
|
|
|
return $this->price; |
210
|
|
|
} |
211
|
|
|
} |
212
|
|
|
|