Skip to content

Commit 5ac7bfc

Browse files
committed
Fix publishing digitizer configuration
1 parent af23b58 commit 5ac7bfc

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

Element/Digitizer.php

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static function getDefaultConfiguration()
5151
*
5252
* @inheritdoc
5353
*/
54-
public function getConfiguration()
54+
public function getConfiguration($public = true)
5555
{
5656
$configuration = parent::getConfiguration();
5757
$configuration['debug'] = isset($configuration['debug']) ? $configuration['debug'] : false;
@@ -65,6 +65,11 @@ public function getConfiguration()
6565
$scheme['featureType'] = $featureTypes[ $featureTypeName ];
6666
$scheme['featureTypeName'] = $featureTypeName;
6767
}
68+
69+
if ($public) {
70+
$this->cleanFromInternConfiguration($scheme['featureType']);
71+
}
72+
6873
if (isset($scheme['formItems'])) {
6974
$scheme['formItems'] = $this->prepareItems($scheme['formItems']);
7075
}
@@ -107,7 +112,7 @@ protected function prepareQueriedFeatureData($feature, $formItems)
107112
public function httpAction($action)
108113
{
109114
/** @var $requestService Request */
110-
$configuration = $this->getConfiguration();
115+
$configuration = $this->getConfiguration(false);
111116
$requestService = $this->container->get('request');
112117
$request = json_decode($requestService->getContent(), true);
113118
$schemas = $configuration["schemes"];
@@ -263,4 +268,26 @@ public function httpAction($action)
263268

264269
return new JsonResponse($results);
265270
}
271+
272+
/**
273+
* Clean feature type configuration for public use
274+
*
275+
* @param array $featureType
276+
* @return array
277+
*/
278+
protected function cleanFromInternConfiguration(array &$featureType)
279+
{
280+
foreach (array(
281+
'filter',
282+
'geomField',
283+
'table',
284+
'connection',
285+
'uniqueId',
286+
'sql',
287+
'events'
288+
) as $keyName) {
289+
unset($featureType[ $keyName ]);
290+
}
291+
return $featureType;
292+
}
266293
}

0 commit comments

Comments
 (0)