Commit 8e9f53bc authored by François Agneray's avatar François Agneray
Browse files

#35 => Fixed bug done

parent 5cd66f11
...@@ -103,28 +103,7 @@ final class AttributeAction ...@@ -103,28 +103,7 @@ final class AttributeAction
if ($request->isPut()) { if ($request->isPut()) {
$parsedBody = $request->getParsedBody(); $parsedBody = $request->getParsedBody();
$this->editAttribute($attribute, $parsedBody);
if (is_null($parsedBody['id_criteria_family'])) {
$criteriaFamily = null;
} else {
$criteriaFamily = $this->memf->getMetaEntityManager()->find(
'App\Entity\Metamodel\CriteriaFamily',
$parsedBody['id_criteria_family']
);
}
if (is_null($parsedBody['id_output_category'])) {
$outputCategory = null;
} else {
$outputCategory = $this->memf->getMetaEntityManager()->find(
'App\Entity\Metamodel\OutputCategory',
$parsedBody['id_output_category']
);
}
$this->editAttribute($attribute, $parsedBody, $criteriaFamily, $outputCategory);
$this->memf->getMetaEntityManager()->flush();
$newResponse = $response->withJson($attribute); $newResponse = $response->withJson($attribute);
} }
...@@ -133,9 +112,7 @@ final class AttributeAction ...@@ -133,9 +112,7 @@ final class AttributeAction
private function editAttribute( private function editAttribute(
Attribute $attribute, Attribute $attribute,
array $parsedBody, array $parsedBody
CriteriaFamily $criteriaFamily = null,
OutputCategory $outputCategory = null
): void { ): void {
$attribute->setLabel($parsedBody['label']); $attribute->setLabel($parsedBody['label']);
$attribute->setFormLabel($parsedBody['form_label']); $attribute->setFormLabel($parsedBody['form_label']);
...@@ -169,7 +146,7 @@ final class AttributeAction ...@@ -169,7 +146,7 @@ final class AttributeAction
$criteriaFamily = null; $criteriaFamily = null;
} else { } else {
$criteriaFamily = $this->memf->getMetaEntityManager()->find( $criteriaFamily = $this->memf->getMetaEntityManager()->find(
'App\Entity\CriteriaFamily', 'App\Entity\Metamodel\CriteriaFamily',
$parsedBody['id_criteria_family'] $parsedBody['id_criteria_family']
); );
} }
...@@ -178,7 +155,7 @@ final class AttributeAction ...@@ -178,7 +155,7 @@ final class AttributeAction
$outputCategory = null; $outputCategory = null;
} else { } else {
$outputCategory = $this->memf->getMetaEntityManager()->find( $outputCategory = $this->memf->getMetaEntityManager()->find(
'App\Entity\OutputCategory', 'App\Entity\Metamodel\OutputCategory',
$parsedBody['id_output_category'] $parsedBody['id_output_category']
); );
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment