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 Dummy |
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 \DateTime A dummy date. |
39
|
|
|
* |
40
|
|
|
* @ORM\Column(type="datetime", nullable=true) |
41
|
|
|
* @Assert\DateTime |
42
|
|
|
*/ |
43
|
|
|
public $dummyDate; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var bool |
47
|
|
|
* |
48
|
|
|
* @ORM\Column(type="boolean", nullable=true) |
49
|
|
|
*/ |
50
|
|
|
public $enabled; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var string The dummy name. |
54
|
|
|
* |
55
|
|
|
* @ORM\Column(nullable=true) |
56
|
|
|
* @Iri("http://schema.org/name") |
57
|
|
|
*/ |
58
|
|
|
private $name; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var float The dummy price. |
62
|
|
|
* |
63
|
|
|
* @ORM\Column(type="float", nullable=true) |
64
|
|
|
*/ |
65
|
|
|
private $price; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @var RelatedDummy A related dummy. |
69
|
|
|
* |
70
|
|
|
* @ORM\ManyToOne(targetEntity="RelatedDummy") |
71
|
|
|
*/ |
72
|
|
|
public $relatedDummy; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @var ArrayCollection Several dummies. |
76
|
|
|
* |
77
|
|
|
* @ORM\ManyToMany(targetEntity="RelatedDummy") |
78
|
|
|
*/ |
79
|
|
|
public $relatedDummies; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Constructor. |
83
|
|
|
*/ |
84
|
|
|
public function __construct() |
85
|
|
|
{ |
86
|
|
|
$this->relatedDummies = new ArrayCollection(); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @return int |
91
|
|
|
*/ |
92
|
|
|
public function getId() |
93
|
|
|
{ |
94
|
|
|
return $this->id; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @param $name |
99
|
|
|
*/ |
100
|
|
|
public function setName($name) |
101
|
|
|
{ |
102
|
|
|
$this->name = $name; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @return string |
107
|
|
|
*/ |
108
|
|
|
public function getName() |
109
|
|
|
{ |
110
|
|
|
return $this->name; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @param \DateTime $dummyDate |
115
|
|
|
*/ |
116
|
|
|
public function setDummyDate(\DateTime $dummyDate) |
117
|
|
|
{ |
118
|
|
|
$this->dummyDate = $dummyDate; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @return \DateTime |
123
|
|
|
*/ |
124
|
|
|
public function getDummyDate() |
125
|
|
|
{ |
126
|
|
|
return $this->dummyDate; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* Disables entity. |
131
|
|
|
* |
132
|
|
|
* @return $this |
133
|
|
|
*/ |
134
|
|
|
public function disable() |
135
|
|
|
{ |
136
|
|
|
$this->enabled = false; |
137
|
|
|
|
138
|
|
|
return $this; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* Enables entity. |
143
|
|
|
* |
144
|
|
|
* @return $this |
145
|
|
|
*/ |
146
|
|
|
public function enable() |
147
|
|
|
{ |
148
|
|
|
$this->enabled = true; |
149
|
|
|
|
150
|
|
|
return $this; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* Gets IsEnabled. |
155
|
|
|
* |
156
|
|
|
* @return string|null |
157
|
|
|
*/ |
158
|
|
|
public function isEnabled() |
159
|
|
|
{ |
160
|
|
|
return $this->enabled; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* Sets Price. |
165
|
|
|
* |
166
|
|
|
* @param float $price |
167
|
|
|
* |
168
|
|
|
* @return $this |
169
|
|
|
*/ |
170
|
|
|
public function setPrice($price) |
171
|
|
|
{ |
172
|
|
|
$this->price = $price; |
173
|
|
|
|
174
|
|
|
return $this; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* Gets Price. |
179
|
|
|
* |
180
|
|
|
* @return float|null |
181
|
|
|
*/ |
182
|
|
|
public function getPrice() |
183
|
|
|
{ |
184
|
|
|
return $this->price; |
185
|
|
|
} |
186
|
|
|
} |
187
|
|
|
|