1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Victoire\Bundle\CoreBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
6
|
|
|
use Doctrine\Common\Collections\Collection; |
7
|
|
|
use Doctrine\ORM\Mapping as ORM; |
8
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
9
|
|
|
use JMS\Serializer\Annotation as Serializer; |
10
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
11
|
|
|
use Victoire\Bundle\BusinessPageBundle\Entity\BusinessTemplate; |
12
|
|
|
use Victoire\Bundle\TemplateBundle\Entity\Template; |
13
|
|
|
use Victoire\Bundle\ViewReferenceBundle\ViewReference\ViewReference; |
14
|
|
|
use Victoire\Bundle\WidgetBundle\Entity\Widget; |
15
|
|
|
use Victoire\Bundle\WidgetMapBundle\Entity\WidgetMap; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Victoire View |
19
|
|
|
* A victoire view is a visual representation with a widget map. |
20
|
|
|
* |
21
|
|
|
* @Gedmo\Tree(type="nested") |
22
|
|
|
* @ORM\InheritanceType("SINGLE_TABLE") |
23
|
|
|
* @ORM\DiscriminatorColumn(name="type", type="string") |
24
|
|
|
* @ORM\Entity(repositoryClass="Victoire\Bundle\CoreBundle\Repository\ViewRepository") |
25
|
|
|
* @ORM\Table("vic_view") |
26
|
|
|
* @ORM\HasLifecycleCallbacks |
27
|
|
|
*/ |
28
|
|
|
abstract class View |
29
|
|
|
{ |
30
|
|
|
use \Gedmo\Timestampable\Traits\TimestampableEntity; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var int |
34
|
|
|
* |
35
|
|
|
* @ORM\Column(name="id", type="integer") |
36
|
|
|
* @ORM\Id |
37
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
38
|
|
|
*/ |
39
|
|
|
protected $id; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var string |
43
|
|
|
* |
44
|
|
|
* @Assert\NotBlank() |
45
|
|
|
* @ORM\Column(name="name", type="string", length=255) |
46
|
|
|
* @Serializer\Groups({"search"}) |
47
|
|
|
* @Gedmo\Translatable |
48
|
|
|
*/ |
49
|
|
|
protected $name; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var string |
53
|
|
|
* |
54
|
|
|
* @ORM\Column(name="bodyId", type="string", length=255, nullable=true) |
55
|
|
|
*/ |
56
|
|
|
protected $bodyId; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @var string |
60
|
|
|
* |
61
|
|
|
* @ORM\Column(name="bodyClass", type="string", length=255, nullable=true) |
62
|
|
|
*/ |
63
|
|
|
protected $bodyClass; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @var string |
67
|
|
|
* |
68
|
|
|
* @Gedmo\Slug(handlers={ |
69
|
|
|
* @Gedmo\SlugHandler(class="Victoire\Bundle\BusinessEntityBundle\Handler\TwigSlugHandler" |
70
|
|
|
* )},fields={"name"}, updatable=false, unique=false) |
71
|
|
|
* @Gedmo\Translatable |
72
|
|
|
* @ORM\Column(name="slug", type="string", length=255) |
73
|
|
|
*/ |
74
|
|
|
protected $slug; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @var [WidgetMap] |
78
|
|
|
* |
79
|
|
|
* @ORM\OneToMany(targetEntity="\Victoire\Bundle\WidgetMapBundle\Entity\WidgetMap", mappedBy="view", orphanRemoval=true, cascade={"persist", "remove"}) |
80
|
|
|
*/ |
81
|
|
|
protected $widgetMaps = []; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @Gedmo\TreeParent |
85
|
|
|
* @ORM\ManyToOne(targetEntity="View", inversedBy="children", cascade={"persist"}) |
86
|
|
|
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id") |
87
|
|
|
*/ |
88
|
|
|
protected $parent; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @var int |
92
|
|
|
* |
93
|
|
|
* @ORM\Column(name="position", type="integer", nullable=false) |
94
|
|
|
*/ |
95
|
|
|
protected $position = 0; |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @Gedmo\TreeLeft |
99
|
|
|
* @ORM\Column(name="lft", type="integer") |
100
|
|
|
*/ |
101
|
|
|
protected $lft; |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @Gedmo\TreeLevel |
105
|
|
|
* @ORM\Column(name="lvl", type="integer") |
106
|
|
|
*/ |
107
|
|
|
protected $lvl; |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @Gedmo\TreeRight |
111
|
|
|
* @ORM\Column(name="rgt", type="integer") |
112
|
|
|
*/ |
113
|
|
|
protected $rgt; |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @Gedmo\TreeRoot |
117
|
|
|
* @ORM\Column(name="root", type="integer", nullable=true) |
118
|
|
|
*/ |
119
|
|
|
protected $root; |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @ORM\OneToMany(targetEntity="View", mappedBy="parent", cascade={"remove"}) |
123
|
|
|
* @ORM\OrderBy({"lft" = "ASC"}) |
124
|
|
|
*/ |
125
|
|
|
protected $children = []; |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* This relation is dynamicly added by PageSubscriber. |
129
|
|
|
*/ |
130
|
|
|
protected $author; |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @var string |
134
|
|
|
* |
135
|
|
|
* @ORM\Column(name="undeletable", type="boolean") |
136
|
|
|
*/ |
137
|
|
|
protected $undeletable = false; |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @var ViewReference[] |
141
|
|
|
* The reference is related to viewsReferences.xml file which list all app views. |
142
|
|
|
* This is used to speed up the routing system and identify virtual pages (BusinessPage). |
143
|
|
|
*/ |
144
|
|
|
protected $references; |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @var string |
148
|
|
|
* |
149
|
|
|
* @ORM\ManyToOne(targetEntity="\Victoire\Bundle\TemplateBundle\Entity\Template", inversedBy="inheritors", cascade={"persist"}) |
150
|
|
|
* @ORM\JoinColumn(name="template_id", referencedColumnName="id", onDelete="CASCADE") |
151
|
|
|
*/ |
152
|
|
|
protected $template; |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @var string |
156
|
|
|
* |
157
|
|
|
* @ORM\Column(name="cssHash", type="string", length=40 ,nullable=true) |
158
|
|
|
*/ |
159
|
|
|
protected $cssHash; |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @deprecated |
163
|
|
|
* @ORM\Column(name="widget_map", type="array") |
164
|
|
|
*/ |
165
|
|
|
protected $widgetMap = []; |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* @var string |
169
|
|
|
* |
170
|
|
|
* @ORM\OneToMany(targetEntity="\Victoire\Bundle\WidgetBundle\Entity\Widget", mappedBy="view", cascade={"persist", "remove"}) |
171
|
|
|
* @ORM\OrderBy({"id" = "ASC"}) |
172
|
|
|
*/ |
173
|
|
|
protected $widgets; |
174
|
|
|
/** |
175
|
|
|
* @var bool |
176
|
|
|
* |
177
|
|
|
* @ORM\Column(name="cssUpToDate", type="boolean") |
178
|
|
|
*/ |
179
|
|
|
protected $cssUpToDate = false; |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @Gedmo\Locale |
183
|
|
|
* Used locale to override Translation listener`s locale |
184
|
|
|
* this is not a mapped field of entity metadata, just a simple property |
185
|
|
|
* and it is not necessary because globally locale can be set in listener |
186
|
|
|
*/ |
187
|
|
|
protected $locale; |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* Construct. |
191
|
|
|
**/ |
192
|
|
|
public function __construct() |
193
|
|
|
{ |
194
|
|
|
$this->children = new ArrayCollection(); |
|
|
|
|
195
|
|
|
$this->widgetMaps = new ArrayCollection(); |
|
|
|
|
196
|
|
|
$this->translations = new ArrayCollection(); |
|
|
|
|
197
|
|
|
$this->references = []; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* to string. |
202
|
|
|
* |
203
|
|
|
* @return string |
204
|
|
|
**/ |
205
|
|
|
public function __toString() |
206
|
|
|
{ |
207
|
|
|
return $this->getName(); |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* Get id. |
212
|
|
|
* |
213
|
|
|
* @return int |
214
|
|
|
*/ |
215
|
|
|
public function getId() |
216
|
|
|
{ |
217
|
|
|
return $this->id; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* Set id. |
222
|
|
|
* |
223
|
|
|
* @param id $id |
224
|
|
|
*/ |
225
|
|
|
public function setId($id) |
226
|
|
|
{ |
227
|
|
|
$this->id = $id; |
|
|
|
|
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* Get name. |
232
|
|
|
* |
233
|
|
|
* @return string |
234
|
|
|
*/ |
235
|
|
|
public function getName() |
236
|
|
|
{ |
237
|
|
|
return $this->name; |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* Set name. |
242
|
|
|
* |
243
|
|
|
* @param string $name |
244
|
|
|
* |
245
|
|
|
* @return View |
246
|
|
|
*/ |
247
|
|
|
public function setName($name) |
248
|
|
|
{ |
249
|
|
|
$this->name = $name; |
250
|
|
|
|
251
|
|
|
return $this; |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
/** |
255
|
|
|
* Set slug. |
256
|
|
|
* |
257
|
|
|
* @param string $slug |
258
|
|
|
* |
259
|
|
|
* @return View |
260
|
|
|
*/ |
261
|
|
|
public function setSlug($slug) |
262
|
|
|
{ |
263
|
|
|
$this->slug = $slug; |
264
|
|
|
|
265
|
|
|
return $this; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* Get slug. |
270
|
|
|
* |
271
|
|
|
* @return string |
272
|
|
|
*/ |
273
|
|
|
public function getSlug() |
274
|
|
|
{ |
275
|
|
|
return $this->slug; |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
/** |
279
|
|
|
* Set template. |
280
|
|
|
* |
281
|
|
|
* @param View $template |
282
|
|
|
* |
283
|
|
|
* @return View |
284
|
|
|
*/ |
285
|
|
|
public function setTemplate($template) |
286
|
|
|
{ |
287
|
|
|
$this->template = $template; |
|
|
|
|
288
|
|
|
|
289
|
|
|
return $this; |
290
|
|
|
} |
291
|
|
|
|
292
|
|
|
/** |
293
|
|
|
* Get template. |
294
|
|
|
* |
295
|
|
|
* @return string |
296
|
|
|
*/ |
297
|
|
|
public function getTemplate() |
298
|
|
|
{ |
299
|
|
|
return $this->template; |
300
|
|
|
} |
301
|
|
|
|
302
|
|
|
/** |
303
|
|
|
* Set parent. |
304
|
|
|
* |
305
|
|
|
* @param View $parent |
306
|
|
|
*/ |
307
|
|
|
public function setParent(View $parent = null) |
308
|
|
|
{ |
309
|
|
|
$this->parent = $parent; |
310
|
|
|
} |
311
|
|
|
|
312
|
|
|
/** |
313
|
|
|
* Get parent. |
314
|
|
|
* |
315
|
|
|
* @return View parent |
316
|
|
|
*/ |
317
|
|
|
public function getParent() |
318
|
|
|
{ |
319
|
|
|
return $this->parent; |
320
|
|
|
} |
321
|
|
|
|
322
|
|
|
/** |
323
|
|
|
* Set children. |
324
|
|
|
* |
325
|
|
|
* @param View[] $children |
326
|
|
|
* |
327
|
|
|
* @return View |
328
|
|
|
*/ |
329
|
|
|
public function setChildren($children) |
330
|
|
|
{ |
331
|
|
|
$this->children = $children; |
332
|
|
|
if ($children !== null) { |
333
|
|
|
foreach ($children as $child) { |
334
|
|
|
$child->setParent($this); |
335
|
|
|
} |
336
|
|
|
} |
337
|
|
|
|
338
|
|
|
return $this; |
339
|
|
|
} |
340
|
|
|
|
341
|
|
|
/** |
342
|
|
|
* Get children. |
343
|
|
|
* |
344
|
|
|
* @return View[] |
345
|
|
|
*/ |
346
|
|
|
public function getChildren() |
347
|
|
|
{ |
348
|
|
|
return $this->children; |
349
|
|
|
} |
350
|
|
|
|
351
|
|
|
/** |
352
|
|
|
* Has children. |
353
|
|
|
* |
354
|
|
|
* @return int |
355
|
|
|
*/ |
356
|
|
|
public function hasChildren() |
357
|
|
|
{ |
358
|
|
|
return count($this->children); |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
/** |
362
|
|
|
* Get WebView children. |
363
|
|
|
* |
364
|
|
|
* @return string |
365
|
|
|
*/ |
366
|
|
|
public function getWebViewChildren() |
367
|
|
|
{ |
368
|
|
|
$webViewChildren = []; |
369
|
|
|
foreach ($this->children as $child) { |
370
|
|
|
if (!$child instanceof BusinessTemplate) { |
371
|
|
|
$webViewChildren[] = $child; |
372
|
|
|
} |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
return $webViewChildren; |
376
|
|
|
} |
377
|
|
|
|
378
|
|
|
/** |
379
|
|
|
* Add child. |
380
|
|
|
* |
381
|
|
|
* @param View $child |
382
|
|
|
*/ |
383
|
|
|
public function addChild(View $child) |
384
|
|
|
{ |
385
|
|
|
$this->children[] = $child; |
386
|
|
|
} |
387
|
|
|
|
388
|
|
|
/** |
389
|
|
|
* Remove child. |
390
|
|
|
* |
391
|
|
|
* @param View $child |
392
|
|
|
*/ |
393
|
|
|
public function removeChild(View $child) |
394
|
|
|
{ |
395
|
|
|
$this->children->removeElement($child); |
|
|
|
|
396
|
|
|
} |
397
|
|
|
|
398
|
|
|
/** |
399
|
|
|
* Get the left value. |
400
|
|
|
* |
401
|
|
|
* @return int |
402
|
|
|
*/ |
403
|
|
|
public function getLft() |
404
|
|
|
{ |
405
|
|
|
return $this->lft; |
406
|
|
|
} |
407
|
|
|
|
408
|
|
|
/** |
409
|
|
|
* Set the left value. |
410
|
|
|
* |
411
|
|
|
* @param int $lft |
412
|
|
|
*/ |
413
|
|
|
public function setLft($lft) |
414
|
|
|
{ |
415
|
|
|
$this->lft = $lft; |
416
|
|
|
} |
417
|
|
|
|
418
|
|
|
/** |
419
|
|
|
* Get the right value. |
420
|
|
|
* |
421
|
|
|
* @return int |
422
|
|
|
*/ |
423
|
|
|
public function getRgt() |
424
|
|
|
{ |
425
|
|
|
return $this->rgt; |
426
|
|
|
} |
427
|
|
|
|
428
|
|
|
/** |
429
|
|
|
* Set the right value. |
430
|
|
|
* |
431
|
|
|
* @param int $rgt |
432
|
|
|
*/ |
433
|
|
|
public function setRgt($rgt) |
434
|
|
|
{ |
435
|
|
|
$this->rgt = $rgt; |
436
|
|
|
} |
437
|
|
|
|
438
|
|
|
/** |
439
|
|
|
* Get the level value. |
440
|
|
|
* |
441
|
|
|
* @return int |
442
|
|
|
*/ |
443
|
|
|
public function getLvl() |
444
|
|
|
{ |
445
|
|
|
return $this->lvl; |
446
|
|
|
} |
447
|
|
|
|
448
|
|
|
/** |
449
|
|
|
* Set the level value. |
450
|
|
|
* |
451
|
|
|
* @param int $lvl |
452
|
|
|
*/ |
453
|
|
|
public function setLvl($lvl) |
454
|
|
|
{ |
455
|
|
|
$this->lvl = $lvl; |
456
|
|
|
} |
457
|
|
|
|
458
|
|
|
/** |
459
|
|
|
* Get the root value. |
460
|
|
|
* |
461
|
|
|
* @return int |
462
|
|
|
*/ |
463
|
|
|
public function getRoot() |
464
|
|
|
{ |
465
|
|
|
return $this->root; |
466
|
|
|
} |
467
|
|
|
|
468
|
|
|
/** |
469
|
|
|
* Set the root value. |
470
|
|
|
* |
471
|
|
|
* @param int $root |
472
|
|
|
*/ |
473
|
|
|
public function setRoot($root) |
474
|
|
|
{ |
475
|
|
|
$this->root = $root; |
476
|
|
|
} |
477
|
|
|
|
478
|
|
|
/** |
479
|
|
|
* Set undeletable. |
480
|
|
|
* |
481
|
|
|
* @param bool $undeletable |
482
|
|
|
* |
483
|
|
|
* @return View The current instance |
484
|
|
|
*/ |
485
|
|
|
public function setUndeletable($undeletable) |
486
|
|
|
{ |
487
|
|
|
$this->undeletable = $undeletable; |
|
|
|
|
488
|
|
|
|
489
|
|
|
return $this; |
490
|
|
|
} |
491
|
|
|
|
492
|
|
|
/** |
493
|
|
|
* Is the widget is undeletable. |
494
|
|
|
* |
495
|
|
|
* @return string |
496
|
|
|
*/ |
497
|
|
|
public function isUndeletable() |
498
|
|
|
{ |
499
|
|
|
return $this->undeletable; |
500
|
|
|
} |
501
|
|
|
|
502
|
|
|
/** |
503
|
|
|
* Get author. |
504
|
|
|
* |
505
|
|
|
* @return string |
506
|
|
|
*/ |
507
|
|
|
public function getAuthor() |
508
|
|
|
{ |
509
|
|
|
return $this->author; |
510
|
|
|
} |
511
|
|
|
|
512
|
|
|
/** |
513
|
|
|
* Set author. |
514
|
|
|
* |
515
|
|
|
* @param string $author |
516
|
|
|
* |
517
|
|
|
* @return $this |
518
|
|
|
*/ |
519
|
|
|
public function setAuthor($author) |
520
|
|
|
{ |
521
|
|
|
$this->author = $author; |
522
|
|
|
|
523
|
|
|
return $this; |
524
|
|
|
} |
525
|
|
|
|
526
|
|
|
/** |
527
|
|
|
* Get bodyId. |
528
|
|
|
* |
529
|
|
|
* @return string |
530
|
|
|
*/ |
531
|
|
|
public function getBodyId() |
532
|
|
|
{ |
533
|
|
|
return $this->bodyId; |
534
|
|
|
} |
535
|
|
|
|
536
|
|
|
/** |
537
|
|
|
* Set bodyId. |
538
|
|
|
* |
539
|
|
|
* @param string $bodyId |
540
|
|
|
* |
541
|
|
|
* @return $this |
542
|
|
|
*/ |
543
|
|
|
public function setBodyId($bodyId) |
544
|
|
|
{ |
545
|
|
|
$this->bodyId = $bodyId; |
546
|
|
|
|
547
|
|
|
return $this; |
548
|
|
|
} |
549
|
|
|
|
550
|
|
|
/** |
551
|
|
|
* Get bodyClass. |
552
|
|
|
* |
553
|
|
|
* @return string |
554
|
|
|
*/ |
555
|
|
|
public function getBodyClass() |
556
|
|
|
{ |
557
|
|
|
return $this->bodyClass; |
558
|
|
|
} |
559
|
|
|
|
560
|
|
|
/** |
561
|
|
|
* Set bodyClass. |
562
|
|
|
* |
563
|
|
|
* @param string $bodyClass |
564
|
|
|
* |
565
|
|
|
* @return $this |
566
|
|
|
*/ |
567
|
|
|
public function setBodyClass($bodyClass) |
568
|
|
|
{ |
569
|
|
|
$this->bodyClass = $bodyClass; |
570
|
|
|
|
571
|
|
|
return $this; |
572
|
|
|
} |
573
|
|
|
|
574
|
|
|
/** |
575
|
|
|
* Set widgets. |
576
|
|
|
* |
577
|
|
|
* @param [WidgetMap] $widgetMaps |
|
|
|
|
578
|
|
|
* |
579
|
|
|
* @return View |
580
|
|
|
*/ |
581
|
|
|
public function setWidgetMaps($widgetMaps) |
582
|
|
|
{ |
583
|
|
|
$this->widgetMaps = $widgetMaps; |
584
|
|
|
|
585
|
|
|
return $this; |
586
|
|
|
} |
587
|
|
|
|
588
|
|
|
/** |
589
|
|
|
* Get widgets. |
590
|
|
|
* |
591
|
|
|
* @return Collection[WidgetMap] |
|
|
|
|
592
|
|
|
*/ |
593
|
|
|
public function getWidgetMaps() |
594
|
|
|
{ |
595
|
|
|
return $this->widgetMaps; |
596
|
|
|
} |
597
|
|
|
|
598
|
|
|
/** |
599
|
|
|
* Add widget. |
600
|
|
|
* |
601
|
|
|
* @param Widget $widgetMap |
602
|
|
|
*/ |
603
|
|
|
public function addWidgetMap(WidgetMap $widgetMap) |
604
|
|
|
{ |
605
|
|
|
if (!$widgetMap->getView()) { |
606
|
|
|
$widgetMap->setView($this); |
607
|
|
|
} |
608
|
|
|
$this->widgetMaps[] = $widgetMap; |
609
|
|
|
} |
610
|
|
|
|
611
|
|
|
/** |
612
|
|
|
* Remove a widgetMap. |
613
|
|
|
* |
614
|
|
|
* @param WidgetMap $widgetMap |
615
|
|
|
*/ |
616
|
|
|
public function removeWidgetMap(WidgetMap $widgetMap) |
617
|
|
|
{ |
618
|
|
|
$this->widgetMaps->removeElement($widgetMap); |
|
|
|
|
619
|
|
|
} |
620
|
|
|
|
621
|
|
|
/** |
622
|
|
|
* Get widgets ids as array. |
623
|
|
|
* |
624
|
|
|
* @return array |
625
|
|
|
*/ |
626
|
|
|
public function getWidgetsIds() |
627
|
|
|
{ |
628
|
|
|
$widgetIds = []; |
629
|
|
|
foreach ($this->getBuiltWidgetMap() as $slot => $_widgetMaps) { |
630
|
|
|
foreach ($_widgetMaps as $widgetMap) { |
631
|
|
|
$widgetIds[] = $widgetMap->getWidget()->getId(); |
632
|
|
|
} |
633
|
|
|
} |
634
|
|
|
|
635
|
|
|
return $widgetIds; |
636
|
|
|
} |
637
|
|
|
|
638
|
|
|
/** |
639
|
|
|
* Get builtWidgetMap. |
640
|
|
|
* |
641
|
|
|
* @return array |
642
|
|
|
*/ |
643
|
|
|
public function getBuiltWidgetMap() |
644
|
|
|
{ |
645
|
|
|
return $this->builtWidgetMap; |
|
|
|
|
646
|
|
|
} |
647
|
|
|
|
648
|
|
|
/** |
649
|
|
|
* Set builtWidgetMap. |
650
|
|
|
* |
651
|
|
|
* @param string $builtWidgetMap |
652
|
|
|
* |
653
|
|
|
* @return $this |
654
|
|
|
*/ |
655
|
|
|
public function setBuiltWidgetMap($builtWidgetMap) |
656
|
|
|
{ |
657
|
|
|
$this->builtWidgetMap = $builtWidgetMap; |
|
|
|
|
658
|
|
|
|
659
|
|
|
return $this; |
660
|
|
|
} |
661
|
|
|
|
662
|
|
|
/** |
663
|
|
|
* Get discriminator type. |
664
|
|
|
* |
665
|
|
|
* @return int |
666
|
|
|
*/ |
667
|
|
|
public function getType() |
668
|
|
|
{ |
669
|
|
|
$class = get_called_class(); |
670
|
|
|
|
671
|
|
|
return $class::TYPE; |
672
|
|
|
} |
673
|
|
|
|
674
|
|
|
/** |
675
|
|
|
* Set position. |
676
|
|
|
* |
677
|
|
|
* @param int $position |
678
|
|
|
*/ |
679
|
|
|
public function setPosition($position) |
680
|
|
|
{ |
681
|
|
|
$this->position = $position; |
682
|
|
|
} |
683
|
|
|
|
684
|
|
|
/** |
685
|
|
|
* Get position. |
686
|
|
|
* |
687
|
|
|
* @return int |
688
|
|
|
*/ |
689
|
|
|
public function getPosition() |
690
|
|
|
{ |
691
|
|
|
return $this->position; |
692
|
|
|
} |
693
|
|
|
|
694
|
|
|
/** |
695
|
|
|
* Get reference according to the current locale. |
696
|
|
|
* |
697
|
|
|
* @param string $locale |
698
|
|
|
* |
699
|
|
|
* @return null|ViewReference |
700
|
|
|
*/ |
701
|
|
|
public function getReference($locale = null) |
702
|
|
|
{ |
703
|
|
|
$locale = $locale ?: $this->getLocale(); |
704
|
|
|
if (is_array($this->references) && isset($this->references[$locale])) { |
705
|
|
|
return $this->references[$locale]; |
706
|
|
|
} |
707
|
|
|
} |
708
|
|
|
|
709
|
|
|
/** |
710
|
|
|
* Get references. |
711
|
|
|
* |
712
|
|
|
* @return ViewReference[] |
713
|
|
|
*/ |
714
|
|
|
public function getReferences() |
715
|
|
|
{ |
716
|
|
|
return $this->references; |
717
|
|
|
} |
718
|
|
|
|
719
|
|
|
/** |
720
|
|
|
* Set references. |
721
|
|
|
* |
722
|
|
|
* @param ViewReference[] $references |
723
|
|
|
* |
724
|
|
|
* @return $this |
725
|
|
|
*/ |
726
|
|
|
public function setReferences($references) |
727
|
|
|
{ |
728
|
|
|
$this->references = $references; |
729
|
|
|
|
730
|
|
|
return $this; |
731
|
|
|
} |
732
|
|
|
|
733
|
|
|
/** |
734
|
|
|
* Set reference. |
735
|
|
|
* |
736
|
|
|
* @param ViewReference $reference |
737
|
|
|
* @param string $locale |
738
|
|
|
* |
739
|
|
|
* @return $this |
740
|
|
|
*/ |
741
|
|
|
public function setReference(ViewReference $reference, $locale = null) |
742
|
|
|
{ |
743
|
|
|
$locale = $locale ?: $this->getLocale(); |
744
|
|
|
$this->references[$locale] = $reference; |
745
|
|
|
|
746
|
|
|
return $this; |
747
|
|
|
} |
748
|
|
|
|
749
|
|
|
/** |
750
|
|
|
* Get CSS hash. |
751
|
|
|
* |
752
|
|
|
* @return string |
753
|
|
|
*/ |
754
|
|
|
public function getCssHash() |
755
|
|
|
{ |
756
|
|
|
return $this->cssHash; |
757
|
|
|
} |
758
|
|
|
|
759
|
|
|
/** |
760
|
|
|
* Set CSS hash. |
761
|
|
|
* |
762
|
|
|
* @param string $cssHash |
763
|
|
|
* |
764
|
|
|
* @return $this |
765
|
|
|
*/ |
766
|
|
|
public function setCssHash($cssHash) |
767
|
|
|
{ |
768
|
|
|
$this->cssHash = $cssHash; |
769
|
|
|
|
770
|
|
|
return $this; |
771
|
|
|
} |
772
|
|
|
|
773
|
|
|
/** |
774
|
|
|
* Change cssHash. |
775
|
|
|
*/ |
776
|
|
|
public function changeCssHash() |
777
|
|
|
{ |
778
|
|
|
$this->cssHash = sha1(uniqid()); |
779
|
|
|
} |
780
|
|
|
|
781
|
|
|
/** |
782
|
|
|
* @deprecated |
783
|
|
|
* Get widgetMap. |
784
|
|
|
* |
785
|
|
|
* @return widgetMap |
786
|
|
|
*/ |
787
|
|
|
public function getWidgetMap() |
788
|
|
|
{ |
789
|
|
|
return $this->widgetMap; |
|
|
|
|
790
|
|
|
} |
791
|
|
|
|
792
|
|
|
/** |
793
|
|
|
* @deprecated |
794
|
|
|
* Get widgets. |
795
|
|
|
* |
796
|
|
|
* @return string |
797
|
|
|
*/ |
798
|
|
|
public function getWidgets() |
799
|
|
|
{ |
800
|
|
|
return $this->widgets; |
801
|
|
|
} |
802
|
|
|
|
803
|
|
|
public function isTemplateOf(View $view) |
804
|
|
|
{ |
805
|
|
|
while ($_view = $view->getTemplate()) { |
806
|
|
|
if ($this == $_view) { |
807
|
|
|
return true; |
808
|
|
|
} |
809
|
|
|
$view = $_view; |
810
|
|
|
} |
811
|
|
|
|
812
|
|
|
return false; |
813
|
|
|
} |
814
|
|
|
|
815
|
|
|
/** |
816
|
|
|
* Get cssUpToDate. |
817
|
|
|
* |
818
|
|
|
* @return bool |
819
|
|
|
*/ |
820
|
|
|
public function isCssUpToDate() |
821
|
|
|
{ |
822
|
|
|
return $this->cssUpToDate; |
823
|
|
|
} |
824
|
|
|
|
825
|
|
|
/** |
826
|
|
|
* Set CssUpToDate. |
827
|
|
|
* |
828
|
|
|
* @param bool $cssUpToDate |
829
|
|
|
* |
830
|
|
|
* @return $this |
831
|
|
|
*/ |
832
|
|
|
public function setCssUpToDate($cssUpToDate) |
833
|
|
|
{ |
834
|
|
|
$this->cssUpToDate = $cssUpToDate; |
835
|
|
|
|
836
|
|
|
return $this; |
837
|
|
|
} |
838
|
|
|
|
839
|
|
|
public function setTranslatableLocale($locale) |
840
|
|
|
{ |
841
|
|
|
$this->locale = $locale; |
842
|
|
|
} |
843
|
|
|
|
844
|
|
|
/** |
845
|
|
|
* @return string |
846
|
|
|
*/ |
847
|
|
|
public function getLocale() |
848
|
|
|
{ |
849
|
|
|
return $this->locale; |
850
|
|
|
} |
851
|
|
|
} |
852
|
|
|
|
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..