Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
anis
anis-server
Commits
7ed75d1f
Commit
7ed75d1f
authored
Jun 20, 2019
by
François Agneray
Browse files
Suppression de la mise à jour de attribute list
parent
4b293d1f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Action/Meta/AttributeListAction.php
View file @
7ed75d1f
...
...
@@ -39,7 +39,7 @@ final class AttributeListAction
$this
->
logger
->
info
(
'Attribute list action dispatched'
);
if
(
$request
->
isOptions
())
{
return
$response
->
withHeader
(
'Access-Control-Allow-Methods'
,
'GET,
PUT,
OPTIONS'
);
return
$response
->
withHeader
(
'Access-Control-Allow-Methods'
,
'GET, OPTIONS'
);
}
$dataset
=
$this
->
em
->
find
(
'App\Entity\Dataset'
,
$args
[
'name'
]);
...
...
@@ -59,55 +59,7 @@ final class AttributeListAction
}
$newResponse
=
$response
->
withJson
(
$attributes
);
}
if
(
$request
->
isPut
())
{
$parsedBody
=
$request
->
getParsedBody
();
foreach
(
$parsedBody
as
$datum
)
{
$attribute
=
$this
->
em
->
getRepository
(
'App\Entity\Attribute'
)
->
findBy
(
array
(
'id'
=>
$datum
[
'id'
],
'dataset'
=>
$dataset
))[
0
];
$criteriaFamily
=
$this
->
em
->
find
(
'App\Entity\CriteriaFamily'
,
$parsedBody
[
'id_criteria_family'
]);
$outputCategory
=
$this
->
em
->
find
(
'App\Entity\OutputCategory'
,
$parsedBody
[
'id_output_category'
]);
$this
->
editAttribute
(
$dataset
,
$attribute
,
$datum
,
$criteriaFamily
,
$outputCategory
);
}
$this
->
em
->
flush
();
$attributes
=
$dataset
->
getAttributes
();
$newResponse
=
$response
->
withJson
(
$attributes
);
}
return
$newResponse
;
}
private
function
editAttribute
(
Dataset
$dataset
,
Attribute
$attribute
,
array
$datum
,
CriteriaFamily
$criteriaFamily
,
OutputCategory
$outputCategory
):
void
{
$attribute
->
setLabel
(
$datum
[
'label'
]);
$attribute
->
setFormLabel
(
$datum
[
'form_label'
]);
$attribute
->
setDescription
(
$datum
[
'description'
]);
$attribute
->
setOutputDisplay
(
$datum
[
'output_display'
]);
$attribute
->
setCriteriaDisplay
(
$datum
[
'criteria_display'
]);
$attribute
->
setSearchFlag
(
$datum
[
'search_flag'
]);
$attribute
->
setSearchType
(
$datum
[
'search_type'
]);
$attribute
->
setOperator
(
$datum
[
'operator'
]);
$attribute
->
setType
(
$datum
[
'type'
]);
$attribute
->
setMin
(
$datum
[
'min'
]);
$attribute
->
setMax
(
$datum
[
'max'
]);
$attribute
->
setPlaceholderMin
(
$datum
[
'placeholder_min'
]);
$attribute
->
setPlaceholderMax
(
$datum
[
'placeholder_max'
]);
$attribute
->
setUriAction
(
$datum
[
'uri_action'
]);
$attribute
->
setRenderer
(
$datum
[
'renderer'
]);
$attribute
->
setDisplayDetail
(
$datum
[
'display_detail'
]);
$attribute
->
setSelected
(
$datum
[
'selected'
]);
$attribute
->
setOrderBy
(
$datum
[
'order_by'
]);
$attribute
->
setOrderDisplay
(
$datum
[
'order_display'
]);
$attribute
->
setDetail
(
$datum
[
'detail'
]);
$attribute
->
setRendererDetail
(
$datum
[
'renderer_detail'
]);
$attribute
->
setOptions
(
$datum
[
'options'
]);
$attribute
->
setVoUtype
(
$datum
[
'vo_utype'
]);
$attribute
->
setVoUcd
(
$datum
[
'vo_ucd'
]);
$attribute
->
setVoUnit
(
$datum
[
'vo_unit'
]);
$attribute
->
setVoDescription
(
$datum
[
'vo_description'
]);
$attribute
->
setVoDatatype
(
$datum
[
'vo_datatype'
]);
$attribute
->
setVoSize
(
$datum
[
'vo_size'
]);
$attribute
->
setCriteriaFamily
(
$criteriaFamily
);
$attribute
->
setOutputCategory
(
$outputCategory
);
}
}
src/routes.php
View file @
7ed75d1f
...
...
@@ -35,7 +35,7 @@ $app->map(['OPTIONS', 'GET', 'POST'], '/metadata/output-category', App\Action\Me
$app
->
map
([
'OPTIONS'
,
'GET'
,
'PUT'
,
'DELETE'
],
'/metadata/output-category/{id}'
,
App\Action\Meta\OutputCategoryAction
::
class
);
$app
->
map
([
'OPTIONS'
,
'GET'
,
'POST'
],
'/metadata/dataset'
,
App\Action\Meta\DatasetListAction
::
class
);
$app
->
map
([
'OPTIONS'
,
'GET'
,
'PUT'
,
'DELETE'
],
'/metadata/dataset/{name}'
,
App\Action\Meta\DatasetAction
::
class
);
$app
->
map
([
'OPTIONS'
,
'GET'
,
'PUT'
],
'/metadata/dataset/{name}/attribute'
,
App\Action\Meta\AttributeListAction
::
class
);
$app
->
map
([
'OPTIONS'
,
'GET'
],
'/metadata/dataset/{name}/attribute'
,
App\Action\Meta\AttributeListAction
::
class
);
$app
->
map
([
'OPTIONS'
,
'GET'
,
'PUT'
],
'/metadata/dataset/{name}/attribute/{id}'
,
App\Action\Meta\AttributeAction
::
class
);
$app
->
map
([
'OPTIONS'
,
'GET'
],
'/metadata/dataset/{name}/criteria'
,
App\Action\Meta\DatasetCriteriaListAction
::
class
);
$app
->
map
([
'OPTIONS'
,
'GET'
],
'/metadata/dataset/{name}/output'
,
App\Action\Meta\DatasetOutputListAction
::
class
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment