|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace LAG\AdminBundle\Admin\Configuration; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping\ClassMetadata; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Ease Admin configuration manipulation |
|
9
|
|
|
*/ |
|
10
|
|
|
class AdminConfiguration |
|
11
|
|
|
{ |
|
12
|
|
|
/** |
|
13
|
|
|
* Admin name |
|
14
|
|
|
* |
|
15
|
|
|
* @var string |
|
16
|
|
|
*/ |
|
17
|
|
|
protected $name; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @var string |
|
21
|
|
|
*/ |
|
22
|
|
|
protected $controllerName; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @var string |
|
26
|
|
|
*/ |
|
27
|
|
|
protected $entityName; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Custom data provider name |
|
31
|
|
|
* |
|
32
|
|
|
* @var string |
|
33
|
|
|
*/ |
|
34
|
|
|
protected $dataProvider; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var string |
|
38
|
|
|
*/ |
|
39
|
|
|
protected $formType; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @var array |
|
43
|
|
|
*/ |
|
44
|
|
|
protected $actions = []; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @var int |
|
48
|
|
|
*/ |
|
49
|
|
|
protected $maxPerPage = 25; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @var string |
|
53
|
|
|
*/ |
|
54
|
|
|
protected $routingNamePattern; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @var string |
|
58
|
|
|
*/ |
|
59
|
|
|
protected $routingUrlPattern; |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @var ClassMetadata |
|
63
|
|
|
*/ |
|
64
|
|
|
protected $metadata; |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Original admin configuration. |
|
68
|
|
|
* |
|
69
|
|
|
* @var array |
|
70
|
|
|
*/ |
|
71
|
|
|
protected $adminConfiguration; |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* AdminConfiguration constructor. |
|
75
|
|
|
* |
|
76
|
|
|
* @param array $configuration |
|
77
|
|
|
*/ |
|
78
|
|
|
public function __construct(array $configuration) |
|
79
|
|
|
{ |
|
80
|
|
|
$this->controllerName = $configuration['controller']; |
|
81
|
|
|
$this->entityName = $configuration['entity']; |
|
82
|
|
|
$this->formType = $configuration['form']; |
|
83
|
|
|
$this->actions = $configuration['actions']; |
|
84
|
|
|
$this->maxPerPage = $configuration['max_per_page']; |
|
85
|
|
|
$this->routingNamePattern = $configuration['routing_name_pattern']; |
|
86
|
|
|
$this->routingUrlPattern = $configuration['routing_url_pattern']; |
|
87
|
|
|
$this->adminConfiguration = $configuration; |
|
88
|
|
|
$this->dataProvider = $configuration['data_provider']; |
|
89
|
|
|
$this->metadata = $configuration['metadata']; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @return string |
|
94
|
|
|
*/ |
|
95
|
|
|
public function getControllerName() |
|
96
|
|
|
{ |
|
97
|
|
|
return $this->controllerName; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* @return string |
|
102
|
|
|
*/ |
|
103
|
|
|
public function getEntityName() |
|
104
|
|
|
{ |
|
105
|
|
|
return $this->entityName; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* @return string |
|
110
|
|
|
*/ |
|
111
|
|
|
public function getFormType() |
|
112
|
|
|
{ |
|
113
|
|
|
return $this->formType; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* @return array |
|
118
|
|
|
*/ |
|
119
|
|
|
public function getActions() |
|
120
|
|
|
{ |
|
121
|
|
|
return $this->actions; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* @return int |
|
126
|
|
|
*/ |
|
127
|
|
|
public function getMaxPerPage() |
|
128
|
|
|
{ |
|
129
|
|
|
return $this->maxPerPage; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* @return string |
|
134
|
|
|
*/ |
|
135
|
|
|
public function getRoutingNamePattern() |
|
136
|
|
|
{ |
|
137
|
|
|
return $this->routingNamePattern; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* @param string $routingNamePattern |
|
142
|
|
|
*/ |
|
143
|
|
|
public function setRoutingNamePattern($routingNamePattern) |
|
144
|
|
|
{ |
|
145
|
|
|
$this->routingNamePattern = $routingNamePattern; |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
/** |
|
149
|
|
|
* @return string |
|
150
|
|
|
*/ |
|
151
|
|
|
public function getRoutingUrlPattern() |
|
152
|
|
|
{ |
|
153
|
|
|
return $this->routingUrlPattern; |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
/** |
|
157
|
|
|
* @param string $routingUrlPattern |
|
158
|
|
|
*/ |
|
159
|
|
|
public function setRoutingUrlPattern($routingUrlPattern) |
|
160
|
|
|
{ |
|
161
|
|
|
$this->routingUrlPattern = $routingUrlPattern; |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
/** |
|
165
|
|
|
* @return ClassMetadata |
|
166
|
|
|
*/ |
|
167
|
|
|
public function getMetadata() |
|
168
|
|
|
{ |
|
169
|
|
|
return $this->metadata; |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
/** |
|
173
|
|
|
* Return custom data provider name. |
|
174
|
|
|
* |
|
175
|
|
|
* @return string |
|
176
|
|
|
*/ |
|
177
|
|
|
public function getDataProvider() |
|
178
|
|
|
{ |
|
179
|
|
|
return $this->dataProvider; |
|
180
|
|
|
} |
|
181
|
|
|
|
|
182
|
|
|
/** |
|
183
|
|
|
* Return original admin configuration. |
|
184
|
|
|
* |
|
185
|
|
|
* @return array |
|
186
|
|
|
*/ |
|
187
|
|
|
public function getAdminConfiguration() |
|
188
|
|
|
{ |
|
189
|
|
|
return $this->adminConfiguration; |
|
190
|
|
|
} |
|
191
|
|
|
} |
|
192
|
|
|
|