|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Lug package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Eric GELOEN <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please read the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Lug\Component\Resource\Model; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* @author GeLo <[email protected]> |
|
16
|
|
|
*/ |
|
17
|
|
|
class Resource implements ResourceInterface |
|
18
|
|
|
{ |
|
19
|
|
|
/** |
|
20
|
|
|
* @var string |
|
21
|
|
|
*/ |
|
22
|
|
|
private $name; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @var string[] |
|
26
|
|
|
*/ |
|
27
|
|
|
private $interfaces; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @var string |
|
31
|
|
|
*/ |
|
32
|
|
|
private $model; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @var string |
|
36
|
|
|
*/ |
|
37
|
|
|
private $driver; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @var string |
|
41
|
|
|
*/ |
|
42
|
|
|
private $driverManager; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @var string |
|
46
|
|
|
*/ |
|
47
|
|
|
private $driverMappingPath; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @var string |
|
51
|
|
|
*/ |
|
52
|
|
|
private $driverMappingFormat; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @var string |
|
56
|
|
|
*/ |
|
57
|
|
|
private $repository; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @var string|null |
|
61
|
|
|
*/ |
|
62
|
|
|
private $factory; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @var string|null |
|
66
|
|
|
*/ |
|
67
|
|
|
private $form; |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @var string|null |
|
71
|
|
|
*/ |
|
72
|
|
|
private $choiceForm; |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @var string|null |
|
76
|
|
|
*/ |
|
77
|
|
|
private $domainManager; |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @var string|null |
|
81
|
|
|
*/ |
|
82
|
|
|
private $controller; |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* @var string|null |
|
86
|
|
|
*/ |
|
87
|
|
|
private $idPropertyPath; |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @var string|null |
|
91
|
|
|
*/ |
|
92
|
|
|
private $labelPropertyPath; |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @var ResourceInterface|null |
|
96
|
|
|
*/ |
|
97
|
|
|
private $translation; |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @param string $name |
|
101
|
|
|
* @param string|string[] $interfaces |
|
102
|
|
|
* @param string $model |
|
103
|
|
|
*/ |
|
104
|
30 |
|
public function __construct($name, $interfaces, $model) |
|
105
|
|
|
{ |
|
106
|
30 |
|
$this->name = $name; |
|
107
|
30 |
|
$this->interfaces = (array) $interfaces; |
|
108
|
30 |
|
$this->model = $model; |
|
109
|
30 |
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* {@inheritdoc} |
|
113
|
|
|
*/ |
|
114
|
12 |
|
public function getName() |
|
115
|
|
|
{ |
|
116
|
12 |
|
return $this->name; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* {@inheritdoc} |
|
121
|
|
|
*/ |
|
122
|
12 |
|
public function getInterfaces() |
|
123
|
|
|
{ |
|
124
|
12 |
|
return $this->interfaces; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* {@inheritdoc} |
|
129
|
|
|
*/ |
|
130
|
13 |
|
public function getModel() |
|
131
|
|
|
{ |
|
132
|
13 |
|
return $this->model; |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* {@inheritdoc} |
|
137
|
|
|
*/ |
|
138
|
8 |
|
public function setModel($model) |
|
139
|
|
|
{ |
|
140
|
8 |
|
$this->model = $model; |
|
141
|
8 |
|
} |
|
142
|
|
|
|
|
143
|
|
|
/** |
|
144
|
|
|
* {@inheritdoc} |
|
145
|
|
|
*/ |
|
146
|
13 |
|
public function getDriver() |
|
147
|
|
|
{ |
|
148
|
13 |
|
return $this->driver; |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
/** |
|
152
|
|
|
* {@inheritdoc} |
|
153
|
|
|
*/ |
|
154
|
15 |
|
public function setDriver($driver) |
|
155
|
|
|
{ |
|
156
|
15 |
|
$this->driver = $driver; |
|
157
|
15 |
|
} |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* {@inheritdoc} |
|
161
|
|
|
*/ |
|
162
|
13 |
|
public function getDriverManager() |
|
163
|
|
|
{ |
|
164
|
13 |
|
return $this->driverManager; |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
/** |
|
168
|
|
|
* {@inheritdoc} |
|
169
|
|
|
*/ |
|
170
|
15 |
|
public function setDriverManager($driverManager) |
|
171
|
|
|
{ |
|
172
|
15 |
|
$this->driverManager = $driverManager; |
|
173
|
15 |
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* {@inheritdoc} |
|
177
|
|
|
*/ |
|
178
|
13 |
|
public function getDriverMappingPath() |
|
179
|
|
|
{ |
|
180
|
13 |
|
return $this->driverMappingPath; |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
/** |
|
184
|
|
|
* {@inheritdoc} |
|
185
|
|
|
*/ |
|
186
|
15 |
|
public function setDriverMappingPath($driverMappingPath) |
|
187
|
|
|
{ |
|
188
|
15 |
|
$this->driverMappingPath = $driverMappingPath; |
|
189
|
15 |
|
} |
|
190
|
|
|
|
|
191
|
|
|
/** |
|
192
|
|
|
* {@inheritdoc} |
|
193
|
|
|
*/ |
|
194
|
13 |
|
public function getDriverMappingFormat() |
|
195
|
|
|
{ |
|
196
|
13 |
|
return $this->driverMappingFormat; |
|
197
|
|
|
} |
|
198
|
|
|
|
|
199
|
|
|
/** |
|
200
|
|
|
* {@inheritdoc} |
|
201
|
|
|
*/ |
|
202
|
15 |
|
public function setDriverMappingFormat($driverMappingFormat) |
|
203
|
|
|
{ |
|
204
|
15 |
|
$this->driverMappingFormat = $driverMappingFormat; |
|
205
|
15 |
|
} |
|
206
|
|
|
|
|
207
|
|
|
/** |
|
208
|
|
|
* {@inheritdoc} |
|
209
|
|
|
*/ |
|
210
|
13 |
|
public function getRepository() |
|
211
|
|
|
{ |
|
212
|
13 |
|
return $this->repository; |
|
213
|
|
|
} |
|
214
|
|
|
|
|
215
|
|
|
/** |
|
216
|
|
|
* {@inheritdoc} |
|
217
|
|
|
*/ |
|
218
|
15 |
|
public function setRepository($repository) |
|
219
|
|
|
{ |
|
220
|
15 |
|
$this->repository = $repository; |
|
221
|
15 |
|
} |
|
222
|
|
|
|
|
223
|
|
|
/** |
|
224
|
|
|
* {@inheritdoc} |
|
225
|
|
|
*/ |
|
226
|
13 |
|
public function getFactory() |
|
227
|
|
|
{ |
|
228
|
13 |
|
return $this->factory; |
|
229
|
|
|
} |
|
230
|
|
|
|
|
231
|
|
|
/** |
|
232
|
|
|
* {@inheritdoc} |
|
233
|
|
|
*/ |
|
234
|
15 |
|
public function setFactory($factory) |
|
235
|
|
|
{ |
|
236
|
15 |
|
$this->factory = $factory; |
|
237
|
15 |
|
} |
|
238
|
|
|
|
|
239
|
|
|
/** |
|
240
|
|
|
* {@inheritdoc} |
|
241
|
|
|
*/ |
|
242
|
13 |
|
public function getForm() |
|
243
|
|
|
{ |
|
244
|
13 |
|
return $this->form; |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
/** |
|
248
|
|
|
* {@inheritdoc} |
|
249
|
|
|
*/ |
|
250
|
15 |
|
public function setForm($form) |
|
251
|
|
|
{ |
|
252
|
15 |
|
$this->form = $form; |
|
253
|
15 |
|
} |
|
254
|
|
|
|
|
255
|
|
|
/** |
|
256
|
|
|
* {@inheritdoc} |
|
257
|
|
|
*/ |
|
258
|
13 |
|
public function getChoiceForm() |
|
259
|
|
|
{ |
|
260
|
13 |
|
return $this->choiceForm; |
|
261
|
|
|
} |
|
262
|
|
|
|
|
263
|
|
|
/** |
|
264
|
|
|
* {@inheritdoc} |
|
265
|
|
|
*/ |
|
266
|
15 |
|
public function setChoiceForm($choiceForm) |
|
267
|
|
|
{ |
|
268
|
15 |
|
$this->choiceForm = $choiceForm; |
|
269
|
15 |
|
} |
|
270
|
|
|
|
|
271
|
|
|
/** |
|
272
|
|
|
* {@inheritdoc} |
|
273
|
|
|
*/ |
|
274
|
13 |
|
public function getDomainManager() |
|
275
|
|
|
{ |
|
276
|
13 |
|
return $this->domainManager; |
|
277
|
|
|
} |
|
278
|
|
|
|
|
279
|
|
|
/** |
|
280
|
|
|
* {@inheritdoc} |
|
281
|
|
|
*/ |
|
282
|
15 |
|
public function setDomainManager($domainManager) |
|
283
|
|
|
{ |
|
284
|
15 |
|
$this->domainManager = $domainManager; |
|
285
|
15 |
|
} |
|
286
|
|
|
|
|
287
|
|
|
/** |
|
288
|
|
|
* {@inheritdoc} |
|
289
|
|
|
*/ |
|
290
|
13 |
|
public function getController() |
|
291
|
|
|
{ |
|
292
|
13 |
|
return $this->controller; |
|
293
|
|
|
} |
|
294
|
|
|
|
|
295
|
|
|
/** |
|
296
|
|
|
* {@inheritdoc} |
|
297
|
|
|
*/ |
|
298
|
15 |
|
public function setController($controller) |
|
299
|
|
|
{ |
|
300
|
15 |
|
$this->controller = $controller; |
|
301
|
15 |
|
} |
|
302
|
|
|
|
|
303
|
|
|
/** |
|
304
|
|
|
* {@inheritdoc} |
|
305
|
|
|
*/ |
|
306
|
13 |
|
public function getIdPropertyPath() |
|
307
|
|
|
{ |
|
308
|
13 |
|
return $this->idPropertyPath; |
|
309
|
|
|
} |
|
310
|
|
|
|
|
311
|
|
|
/** |
|
312
|
|
|
* {@inheritdoc} |
|
313
|
|
|
*/ |
|
314
|
15 |
|
public function setIdPropertyPath($idPropertyPath) |
|
315
|
|
|
{ |
|
316
|
15 |
|
$this->idPropertyPath = $idPropertyPath; |
|
317
|
15 |
|
} |
|
318
|
|
|
|
|
319
|
|
|
/** |
|
320
|
|
|
* {@inheritdoc} |
|
321
|
|
|
*/ |
|
322
|
13 |
|
public function getLabelPropertyPath() |
|
323
|
|
|
{ |
|
324
|
13 |
|
return $this->labelPropertyPath; |
|
325
|
|
|
} |
|
326
|
|
|
|
|
327
|
|
|
/** |
|
328
|
|
|
* {@inheritdoc} |
|
329
|
|
|
*/ |
|
330
|
15 |
|
public function setLabelPropertyPath($labelPropertyPath) |
|
331
|
|
|
{ |
|
332
|
15 |
|
$this->labelPropertyPath = $labelPropertyPath; |
|
333
|
15 |
|
} |
|
334
|
|
|
|
|
335
|
|
|
/** |
|
336
|
|
|
* {@inheritdoc} |
|
337
|
|
|
*/ |
|
338
|
13 |
|
public function getTranslation() |
|
339
|
|
|
{ |
|
340
|
13 |
|
return $this->translation; |
|
341
|
|
|
} |
|
342
|
|
|
|
|
343
|
|
|
/** |
|
344
|
|
|
* {@inheritdoc} |
|
345
|
|
|
*/ |
|
346
|
1 |
|
public function setTranslation(ResourceInterface $translation = null) |
|
347
|
|
|
{ |
|
348
|
1 |
|
$this->translation = $translation; |
|
349
|
1 |
|
} |
|
350
|
|
|
} |
|
351
|
|
|
|