|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Silverback\ApiComponentBundle\Entity\Content\Component\Navigation; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
6
|
|
|
use Silverback\ApiComponentBundle\Entity\Content\Component\AbstractComponent; |
|
7
|
|
|
use Silverback\ApiComponentBundle\Entity\Route\Route; |
|
8
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Class AbstractNavigationItem |
|
12
|
|
|
* @package Silverback\ApiComponentBundle\Entity\Navigation |
|
13
|
|
|
* @author Daniel West <[email protected]> |
|
14
|
|
|
*/ |
|
15
|
|
|
abstract class AbstractNavigationItem extends AbstractComponent implements NavigationItemInterface |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* @ORM\Column() |
|
19
|
|
|
* @Groups({"layout", "content", "component"}) |
|
20
|
|
|
* @var string |
|
21
|
|
|
*/ |
|
22
|
|
|
protected $label; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @ORM\ManyToOne(targetEntity="Silverback\ApiComponentBundle\Entity\Route\Route") |
|
26
|
|
|
* @ORM\JoinColumn(referencedColumnName="route", onDelete="CASCADE") |
|
27
|
|
|
* @Groups({"layout", "content", "component"}) |
|
28
|
|
|
* @var null|Route |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $route; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @ORM\Column(nullable=true) |
|
34
|
|
|
* @Groups({"layout", "content", "component"}) |
|
35
|
|
|
* @var null|string |
|
36
|
|
|
*/ |
|
37
|
|
|
protected $fragment; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @ORM\Column(type="array", nullable=true) |
|
41
|
|
|
* @Groups({"layout", "content", "component"}) |
|
42
|
|
|
* @var null|array |
|
43
|
|
|
*/ |
|
44
|
|
|
protected $roles; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @ORM\Column(type="array", nullable=true) |
|
48
|
|
|
* @Groups({"layout", "content", "component"}) |
|
49
|
|
|
* @var null|array |
|
50
|
|
|
*/ |
|
51
|
|
|
protected $excludeRoles; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @return string |
|
55
|
|
|
*/ |
|
56
|
3 |
|
public function getLabel(): string |
|
57
|
|
|
{ |
|
58
|
3 |
|
return $this->label; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @param string $label |
|
63
|
|
|
* @return AbstractNavigationItem |
|
64
|
|
|
*/ |
|
65
|
4 |
|
public function setLabel(string $label): AbstractNavigationItem |
|
66
|
|
|
{ |
|
67
|
4 |
|
$this->label = $label; |
|
68
|
4 |
|
return $this; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @return null|Route |
|
73
|
|
|
*/ |
|
74
|
|
|
public function getRoute(): ?Route |
|
75
|
|
|
{ |
|
76
|
|
|
return $this->route; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @param null|Route $route |
|
81
|
|
|
* @return AbstractNavigationItem |
|
82
|
|
|
*/ |
|
83
|
|
|
public function setRoute(?Route $route): AbstractNavigationItem |
|
84
|
|
|
{ |
|
85
|
|
|
$this->route = $route; |
|
86
|
|
|
return $this; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @return null|string |
|
91
|
|
|
*/ |
|
92
|
|
|
public function getFragment(): ?string |
|
93
|
|
|
{ |
|
94
|
|
|
return $this->fragment; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @param null|string $fragment |
|
99
|
|
|
* @return AbstractNavigationItem |
|
100
|
|
|
*/ |
|
101
|
|
|
public function setFragment(?string $fragment): AbstractNavigationItem |
|
102
|
|
|
{ |
|
103
|
|
|
$this->fragment = $fragment; |
|
104
|
|
|
return $this; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* @return null|array |
|
109
|
|
|
*/ |
|
110
|
|
|
public function getRoles(): ?array |
|
111
|
|
|
{ |
|
112
|
|
|
return $this->roles; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* @param null|array $roles |
|
117
|
|
|
* @return self |
|
118
|
|
|
*/ |
|
119
|
|
|
public function setRoles(?array $roles): self |
|
120
|
|
|
{ |
|
121
|
|
|
$this->roles = $roles; |
|
122
|
|
|
return $this; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* @return null|array |
|
127
|
|
|
*/ |
|
128
|
|
|
public function getExcludeRoles(): ?array |
|
129
|
|
|
{ |
|
130
|
|
|
return $this->excludeRoles; |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
/** |
|
134
|
|
|
* @param null|array $excludeRoles |
|
135
|
|
|
* @return self |
|
136
|
|
|
*/ |
|
137
|
|
|
public function setExcludeRoles(?array $excludeRoles): self |
|
138
|
|
|
{ |
|
139
|
|
|
$this->excludeRoles = $excludeRoles; |
|
140
|
|
|
return $this; |
|
141
|
|
|
} |
|
142
|
|
|
} |
|
143
|
|
|
|